Eduardo,
I’m sorry for the late reply, but I had extremely little free time during the last weeks. Still haven’t gone through this issue. I’ll try to check it out as soon as possible.
At a first glance, I’d recommend trying to change the filter priority. For example:
if ($curated) echo apply_filters('the_content', $curated, 1000);
The schema.org filter of add-meta-tags has a priority of 500. This way you could possible override it.
I’ll try to reply with more details soon.
Kind Regards,
George
Hi George,
Thank you for your reply.
That didn’t solve it, unfortunately… Please take your time, i’m grateful already for the great support you provide.
Best regards!
Eduardo
Hi Eduardo,
I’ll post a quick reply. If anything is unclear, please let me know so I can rephrase.
First of all, from what I see, you are doing this in the theme template. This might not be the right place. I would highly recommend adding the code to the theme’s functions.php or in a custom plugin, which is theme agnostic.
Second, I think that you are not doing it right. In the following:
apply_filters('the_content', $curated)
$curated should be the name of a filtering function that would filter the post content.
I suggest removing the code from the template and adding it in the functions.php of the theme:
function custom_append_internal_comments($post_body) {
$post = get_queried_object();
$curated = get_post_meta($post->ID, 'curated_comments', true);
if ( ! empty($curated) ) {
return $post_body . $curated;
}
return $post_body;
}
add_filter('the_content', 'custom_append_internal_comments', 200);
Please let me know if it works.
Kind Regards,
George
That’s great George, thank you so much.
It does work. At first, the text of the custom field was not being run through the filters as i needed. Then i started raising the priority of the custom_append_internal_comments function. When i raised it to 9, the auto <p> WordPress filter started working. I had to raise it to a very high 2, because i use a text replace plugin, and it only filters the custom field’s text if i use 2 for custom_append_internal_comments.
Would you supose there’s any problem using a priority of 2?
Again, thank you for going above and beyond all support expectations!
Eduardo
Would you supose there’s any problem using a priority of 2?
No, there should be no problem. The priority is just a way to define the order the filters are executed. If you need to perform some filtering before other filters do their job, then you have to set a low priority, even 0.
Best Regards,
George