How to apply filter from text area

so i’m writing a wordpress plugin and need some insight on getting a problem of mine solved. Any help is appreciated.

So i have my plugin options page with a textarea (option field) and a save button.

<textarea name=”code”></textarea>

What i want to be able to do is to paste a php code like this:

function do_stuff( $stuff ){
$stuff = ‘Hello’;
return stuff;
}

….somewhere in my actual plugin php file; i have created a filter

$stuff….
apply_filters( ‘before_stuff_is_submitted’, $stuff );

so when i save the options, fields … the update is run. I don’t know if this is even possible or if there is an alternative to what i’m trying to do.

I’ve been thinking along this lines too:

function do_stuff( $stuff ){
$stuff = ‘Hello’;
return stuff;
}
add_filter( ‘before_stuff…’, ‘do_stuff’ );

All the code in the text area and have it execute at run-time.

Read more here:: How to apply filter from text area

Leave a Reply

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