WP5000

WordPress Tips, Tricks and Techniques

PHP In Your Posts and Pages

With the addition of the free “Insert PHP Code Snippet” plugin by xyzscripts.com, you can put this code in your functions.php file, then you can add php code directly into Text widgets.

This will work with classic themes and block themes such as Twenty Twenty-Two.

To insert PHP, select XYZ PHP Code (which is not the same name as the snippet), on the left of the WordPress dashboard, then click PHP Code Snippets. Write your code, then you’ll see a shortcode that you can insert in any page or post.

Note that as of this writing, the plugin had not been updated in more than three months.

Side Note: It is possible this plugin could be discontinued, or changed at some point in the future.

I used to use PHP_Everywhere, a similar plugin. One day, the maker of that plugin pushed an update that no longer works with Classic Editor builds. That caused a need to manually add my PHP code in an entirely different way to several websites.


Leave a Reply

Your email address will not be published. Required fields are marked *

There is no need to be confused, frustrated, or waste time with WordPress issues. I’ll be glad to help with phone or screen sharing. I charge $2/minute, with no minimum. The typical call runs 9 minutes ($18). If I can’t efficiently solve your problem, there’s no charge for the call. Contact me any time at (805)-843-5353. You’ll enjoy my friendly, informative manner! – Jeff


Categories