add_filter inside a function
-
i’m creating a plugin, and i want to use add_filter for wp_head for every filter in the_content
this is my code:<?php function content_function($content) { //Analize the_content add_filter('wp_head', 'head_function',1); } function head_function() { echo 'something to put in the head'; } add_filter('the_content', 'content_function', 1);
i want to first analize the_content and if some conition is true then add something to the head, but it doesn’t works
i triend to put the add_filter(‘wp_head’, ‘head_function’,1); outside the function and it works, but inside it doesn’t workwhat can i do?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘add_filter inside a function’ is closed to new replies.