• I have a website that has a content builder that uses multiple wp_editors to create a repeatable WYSIWYG field. When I enable CRP on “post” – a post that uses this content builder – the related posts are showing on every WYSIWYG area on the front end.

    Is there a way to prevent this? The other plugin developer is willing to work with you if necessary.

    Thank you.

    https://www.ads-software.com/plugins/contextual-related-posts/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter dave nicosia

    (@dave-nicosia)

    I found this article that explains the exact problem and the solution:

    https://pippinsplugins.com/playing-nice-with-the-content-filter/

    Here is the part that applies:

    In order to solve this problem, we can use one more conditional tag. The is_main_query() function was introduced in WordPress 3.3 and allows us to check whether we are currently inside of the main post query. The main post query can be thought of as the primary post loop that displays the main content for the post/page or archive. By using this tag, our filter will NOT get applied to any custom loops in sidebars, footers, or elsewhere, even if they use this:

    So, my question is, can you please update your plugin to accommodate this? I’m sure it will solve this issue in many plugins compatibility issues.

    Thanks!

    Plugin Author WebberZone

    (@webberzone)

    Hi Dave,

    I already have a check for this:

    https://github.com/WebberZone/contextual-related-posts/blob/c4cdcd8fda95415fa47b2f8e7bb944d715b10f99/contextual-related-posts.php#L597

    Do you mind changing that line to the below and testing

    if ( ! in_the_loop() || ! is_main_query() ) {
    Thread Starter dave nicosia

    (@dave-nicosia)

    No that didn’t work.

    I’ll describe the issue a bit more.

    So I have a plugin that creates a slider. There are multiple instances of the wp_editor in them and they are run through the content filter: apply_filters(‘the_content’, $wysiwyg_content);

    The plugin need to do this to make shortcodes work in the fields.

    When I remove that content filter from the plugin code – the issue goes away but this is not an option since the wysiwygs in the plugin need to run through the content filter.

    Another note is that the slider created by the plugin is inserted into the post via shortcode.

    Any other ideas?

    Plugin Author WebberZone

    (@webberzone)

    Which plugin is this and is it free so I can check?

    The only alternative I think to get this to work with Contextual Related Posts is to disable the “Add automatically” option for CRP and use the manual installs to insert the related posts in the place you’d prefer them.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Related Posts showing on all WP Editors’ is closed to new replies.