1

I'm using a plugin that appends to the_content() at a priority of 100. I want to place some content after the main content but before this plugin outputs. I assumed if I use a priority less than 100 that it will come before the plugin, but the plugin is always outputting before my extra content.

My code looks like this

add_filter('the_content', 'my_single_post_extra', 10);
function my_single_post_extra($content) {
    if(is_singular('post')) {
        $content = $content . '<p>Extra content</p>';
    }
    return $content;
}

The plugin is appending like follows:

add_filter('the_content', 'fbcommentbox', 100);
function fbcommentbox($content) {
    $content .= '<p>plugin content here</p>';
    return $content;
}

I was under the impression that by using a lower priority than a plugin, that I could get my content to output before its content. Is that not correct? How would I fix this issue?

  • 2
    sorry but what is actually the issue? It sound lie you do not fully understand how the plugin work and except for suggesting doing some more debuggin i am not sure what anyone will be able to say about it.... maybe some other filter changes the content even before that filter, or th plugin remove all other filters on the_content.... there are several options that may explain what you see – Mark Kaplun Apr 1 '17 at 6:16
  • Thanks, you answered my question. I outputted $wp_filter for the the_content hook and was able to see what was being output at the same time. You could put this as an answer as it may help someone else. – tommyf Apr 1 '17 at 7:48
  • since it is kinda low quality question, probably better to just delete it – Mark Kaplun Apr 1 '17 at 8:03
0

It appears that Mark Kaplan's comment led the OP to the proper solution.

But it would be nice for the OP to post his solution as the correct answer, to help others that might have a similar problem.

(Spelunking unanswered questions....)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.