Using PHP Code In WordPress Posts and Pages
When you do advanced WordPress work, there will come to a point when you will want to use PHP code in your posts or Pages, like say a certain template tag. By default, WordPress strips this out so you’ll definitely need a plugin to help you accomplish this.
For a long I used Exec-PHP which is an excellent plugin. The only trouble with it, you cannot switch back and forth between the Visual editor and HTML when you write or edit your posts. If you forget and switch to the Visual, your PHP code is going to be destroyed.
If you’re lucky, you can quickly exit the page without saving and you’ll still be able to save your code. But I’ve had instances where the Auto Save kicked in before I had the opportunity to exit and had to re-do everything.
Also, if you work with clients who aren’t technical, this is a real problem. Clients also like to use the Visual editor a lot.
Recently, I switched to PHP Execution mainly because it can preserve the PHP code. You will need to paste or edit the PHP code in the HTML screen. But you can switch back and forth, edit the post in the Visual editor without problems.
I’ve used this on a few sites now and it’s working well. Very nice.
Do You Want A Hands-Free Business?
Then get this guide to help you systemize your business so you'll have more time working on your business.
Hey! I want to make sure you know what you're getting here. In addition to the guide, you will also receive our memo that includes special offers, announcements and of course actionable information.