• Issue Summary

    When attempting to render YARPP (Yet Another Related Posts Plugin) results inside a Divi 5 Theme Builder template, the related posts query is not displayed, even though YARPP successfully returns related results when invoked inside post content. Technical Details

    • Environment:
      • WordPress (latest stable)
      • Divi 5 (public alpha, Theme Builder templates)
      • YARPP 5.30.11
    • Behavior:
      • When inserting [yarpp] inside post content, related posts render correctly.
      • When inserting [yarpp] or yarpp_related() inside a Divi 5 Theme Builder template (outside of the_content()), the output consistently shows “No related posts found.”
    • Debugging performed:
      • Verified that yarpp_get_related() returns a boolean false instead of a WP_Query object when called from a Divi 5 template context.
      • Confirmed that YARPP’s SQL queries run successfully and that related posts exist in the database.
      • Verified that the Divi 5 template is active and executing by inserting test text/PHP in the same location.
      • This indicates the failure occurs not at the query level, but at the context detection layer.

    Analysis

    YARPP appears to depend on global state ($post and/or in_the_loop) to resolve the current post ID when building the related posts query. In Divi 5, Theme Builder templates render content through a React/PHP bridge rather than the legacy the_content pipeline, meaning these globals are not set as expected.

    Thus:

    • Inside post content → YARPP works (globals available).
    • Inside Divi 5 templates → YARPP fails (globals unavailable, returns boolean).

    Impact

    • YARPP is currently not compatible with Divi 5 Theme Builder templates.
    • Any attempt to display related posts outside of the_content() results in “No related posts found,” even if related posts exist.
    • This breaks expected functionality for sites upgrading to Divi 5 that rely on YARPP in templates.

    Suggested Resolution

    • Update YARPP to accept an explicit post ID parameter (e.g., yarpp_get_related( $post_id )) without requiring global state.
    • Ensure shortcode and function calls respect passed post_id values when Divi (or other block/template systems) do not expose global $post.
    • Alternatively, Divi 5 could provide a compatibility shim that sets $post when rendering templates, but ideally YARPP should not rely solely on globals in modern WP contexts.

The topic ‘Yarpp does not work with divi5’ is closed to new replies.