Viewing 2 replies - 1 through 2 (of 2 total)
  • I just have installed the Exec-PHP to add PHP to my blog, but unfortunately PHP is not executed. As the WYSIWYG editor in WP-admin is refusing in being switched off, though the box in the user setting is unticked, I presume this is the issue.

    I checked the MySQL db, and there the status of rich-editing has status “false”

    So I presume it really is a WP-admin issue…

    The plugin still works fine for me and I’m using the latest version of WordPress 4.2.3…

    Have been using Exec-PHP for years with the same install with no problems at all.

    The only things are to remember to set “deactivate_visual_editor” to “true” when using it in a post (under “Custom Fields” on your post editing screen).

    You also need to keep this in mind (from the Exec-PHP documentation) if you have a RSS feed with posts that include PHP code:

    Why does my newsfeed spits out parsing errors?

    Assume your code is working outside an article. The PHP parser may still spit out error messages in your newsfeed but not if you are viewing your article even if everything seems to be correct. This will happen if you have defined your own functions, classes, etc. For the newsfeeds WordPress will read the content of each article twice (once for the summary and once for the whole article) and so causing the PHP code to be executed twice. For example the following code in your article would work if you view the article on your webpage but would cause your newsfeed to break:

    Article:

    <?php
    function hello()
    {
      echo 'Hello World';
    }
    hello();
    ?>

    As a general rule I would advise to separate all definitions into a file and reference to it by calling require_once(). So the above example would be split into two parts, your article and a file.

    Article:

    <?php
    require_once(ABSPATH. 'example.php');
    hello();
    ?>

    File (here example.php):

    <?php
    function hello()
    {
      echo 'Hello World';
    }
    ?>

    Please note that require_once() is using a fully qualified path. This is mandatory because depending on the context of the viewer a relative path would point to different locations e.g. for viewing your main blog page, viewing a single post, viewing the newsfeed, etc.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is this plugin still working?’ is closed to new replies.