The MU forums have moved to WordPress.org

run php code in Sites/Posts (16 posts)

  1. LarsS
    Member
    Posted 15 years ago #

    Hi,

    is there any plugin, that allows me, to run regular php code in Articles/Pages?
    I found a lot of plugins, but it seems, that all of them work only in a regular wp installation, but not in wpmu..

    Lars

  2. SteveAtty
    Member
    Posted 15 years ago #

    Exactly what are you looking to do?

    It is quite easy to allow the embedding of controlled chunks of PHP code inside a post

  3. LarsS
    Member
    Posted 15 years ago #

    Hi,

    for example: <?php echo 'test'; ?>

    I already changed some options: I switched off the the wysig editor and disabled the option to correct xhtml.
    When i insert php code, it dissappears after updating the page.
    So what do i have to do, to allow a regula php code?
    I want to be able to insert everything i want in php. Is that possible?

    Lars

  4. SteveAtty
    Member
    Posted 15 years ago #

    You can't by default just execute php code like that inside your web page.

    It would be too easy for a user to embed malicious code in there, like:

    mysql_query("truncate wp_site");

  5. LarsS
    Member
    Posted 15 years ago #

    Okay. All users are trustable. In my case Wpmu is used as a cms. What can i do, to change this?

  6. andrea_r
    Moderator
    Posted 15 years ago #

    "but it seems, that all of them work only in a regular wp installation, but not in wpmu.."

    Did you try them in MU?

  7. LarsS
    Member
    Posted 15 years ago #

    Yes,

    maybe i made i mistake. Do you know onw, that could work?

  8. tdjcbe
    Member
    Posted 15 years ago #

    http://wordpress.org/extend/plugins/exec-php/

    Haven't tried in myself on wpmu but others have I believe. I'm sure a search of the forums will pull up previous discussion on the topic.

  9. LarsS
    Member
    Posted 15 years ago #

    I tried it and does not work.

  10. VentureMaker
    Member
    Posted 15 years ago #

    What exactly does not work?

  11. skygold
    Member
    Posted 14 years ago #

    I've been attempting to use exec-php in WPMU as well, to no avail.

    Despite setting everything up per the exec-php manual, when I post code into a Page or Post, WPMU simply eats the code and it disappears on save.

    I've verified that the user account I am using has the visual editor disabled and has the unfiltered_html capability. Still no joy.

    Any help would be appreciated.

  12. skygold
    Member
    Posted 14 years ago #

    Ok, to answer my own question, I found the solution:

    Open your wp-includes/kses.php file. Go to line 1086 and comment it out. The line looks like:

    add_filter('content_save_pre', 'wp_filter_post_kses');

    This disables WPMU from removing code content from a page or post.

    Be aware of security issues, though.

  13. andrea_r
    Moderator
    Posted 14 years ago #

    The "unfiltered html" plugin does the same thing, without a hack. :)

    *insert terrible security warning here*

  14. LarsS
    Member
    Posted 14 years ago #

    Thanks for the answers. INow i use unfilterde html and exec php an it works fine.

  15. technovis
    Member
    Posted 14 years ago #

    I encountered the same situation with WPMU 2.9.1.1, and your solution perfectly worked! Thanks!

    Open your wp-includes/kses.php file. Go to line 1086 and comment it out. The line looks like:

    add_filter('content_save_pre', 'wp_filter_post_kses');

  16. chenow10
    Member
    Posted 14 years ago #

    For MU users, there is a version of the "unfiltered html" plugin called unfiltered MU.

About this Topic