0

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 (below) in the textarea:

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.