Forums

[resolved] How to run PHP on posts and pages (7 posts)

  1. Trahald
    Member
    Posted 4 years ago #

    I want to insert PHP code into my posts and pages.

    How do I do this? Is there some native functionality, or some plugin?

  2. shadow
    Moderator
    Posted 4 years ago #

  3. Trahald
    Member
    Posted 4 years ago #

    Thanks.

    Blah, choices :( Which of these is better/easier, and which is used by more people?

  4. shadow
    Moderator
    Posted 4 years ago #

    Perhaps you could try one and see how it goes, judge it for yourself. Just a thought:)

  5. Trahald
    Member
    Posted 4 years ago #

    Yes but with these things, there's almost always minor little issues that you never find out about until it's too late.

    It would probably be tough to switch from one to the other down the line, and I see no real reason to prefer one over the other right now. Just looking to get some insight from anybody with more experience :)

  6. Trahald
    Member
    Posted 4 years ago #

    Well I ended up going with exec-php, and one of those minor little issues is the wpautop filter. I found that one should use the Disable wpauto plugin (http://wordpress.org/extend/plugins/disable-wpautop/) if embedding php code.

    As well as disabling the WYSIWYG editor (Users->Your Profile), otherwise it'll keep escaping your <?php ?> tags.

  7. kgagne
    Member
    Posted 4 years ago #

    I too use exec-php. I tried one of the other ones (I don't remember which) and it wasn't compatible with the "email this" and "print this" plugins I have installed; users were getting the PHP code emailed and printed, instead of the output of that code. I asked the email/print plugin author why, and he said I wasn't using a "proper" PHP plugin. I switched to exec-php and it works fine.

Topic Closed

This topic has been closed to new replies.

About this Topic