Can you use add_filter() inside other function?


I’m new to WordPress, and currently developing my first plugin and currently having difficulties.

How I can insert the add_filter action inside my submit function? I want the add_filter action to process after the user click the submit button.

I have try this but it didn’t work.

if(isset($_POST['btn_submit'])) {

    function addContent($content = '') {            
        $content .= "My content";

        return $content;

    add_filter('the_content', 'addContent');

Any help would be greatly appreciated. Thanks!

ronniel 5 months 0 Answers 71 views 0

Leave an answer