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?
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?
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....)
the_content
.... there are several options that may explain what you see – Mark Kaplun Commented Apr 1, 2017 at 6:16$wp_filter
for thethe_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 Commented Apr 1, 2017 at 7:48