WPDM single page crash with Rara Business theme – analysis and workaround

Viewing 2 posts - 1 through 2 (of 2 total)
#208377

Doug Nix
Participant

Hi WPDM team,

I’m writing to report an interaction between WordPress Download Manager (WPDM) and the Rara Business theme that consistently crashes WPDM single package pages. I’ve included the environment details, the reproducible error, and the workaround we implemented.

Environment

WordPress: 6.6.2

PHP: 8.2 (running on WHC / cPanel with zlib compression enabled)

WPDM: 3.2.99 (Free)

Theme: Rara Business (latest from WordPress.org, v1.2.9)

Hosting: Linux/Apache with Cloudflare in front

Permalink base for WPDM packages: /files/<slug>/

Problem description

After switching the WPDM package permalink base to /files/, visiting a package single page at /files/<package-slug>/ triggers a fatal error.

Stack trace excerpt:

PHP Fatal error: Uncaught TypeError: explode(): Argument #2 ($string) must be of type string, WP_Error given
in /wp-content/themes/rara-business/inc/template-functions.php:433
#0 /…/template-functions.php(231): rara_business_breadcrumb()
#1 /wp-includes/class-wp-hook.php(324): rara_business_content_start(”)
#2 /wp-includes/plugin.php(517): WP_Hook->do_action()
#3 /wp-content/themes/rara-business/header.php(59): do_action(‘rara_business_content’)
#4 /wp-content/themes/rara-business/single.php(12): get_header()

Root cause:
The theme’s rara_business_content_start() calls rara_business_breadcrumb(), which assumes a post category context. On WPDM singles (custom post type wpdmpro), it receives a WP_Error. This value is passed directly into explode(), producing the fatal.

What we tried

Switched to Twenty Twenty-Five → WPDM singles load normally.

Disabled all MU plugins and caching layers → crash persists with Rara Business.

Built a child theme to gate the do_action( ‘rara_business_content’ ) call → functional but brittle and caused styling regressions.

Minimal, upgrade-safe workaround

We developed a compatibility plugin (wpdm-rara-compat.php) that:

Removes the theme’s content-start callback from the rara_business_content hook.

Re-adds it with a guard so it runs everywhere except on WPDM singles.

Restores normal page layout on WPDM singles by injecting wrapper markup (container/row/content/sidebar) around the_content and aligning the page title.

Plugin code:

<?php
/**
* Plugin Name: WPDM × Rara Business Compat
* Description: Prevents Rara breadcrumb crash on WPDM singles, restores layout.
* Version: 1.0
*/

add_action(‘after_setup_theme’, function () {
// Remove theme’s content-start callback
remove_action(‘rara_business_content’, ‘rara_business_content_start’, 10);

// Re-add guarded callback
add_action(‘rara_business_content’, function () {
if ( is_singular([‘wpdmpro’,’wpdm_package’]) ) return;
if ( function_exists(‘rara_business_content_start’) ) {
rara_business_content_start();
}
}, 10);
}, 99);

// === Layout wrapper for WPDM singles ===
add_filter(‘the_content’, function ($html) {
if (!is_singular(‘wpdmpro’) || !in_the_loop() || !is_main_query()) return $html;

// Prevent double wrapping
if (str_contains($html, ‘class=”site-content single-wpdmpro”‘)) return $html;

ob_start(); get_sidebar(); $sidebar = ob_get_clean();

return
‘<div id=”content” class=”site-content single-wpdmpro”>’ .
‘<div class=”container”><div class=”row”>’ .
‘<main id=”primary” class=”content-area col-lg-8″><div class=”site-main”>’ .
$html .
‘</div></main>’ .
$sidebar .
‘</div></div>’ .
‘</div>’;
}, 20);

// Align WPDM single title with content column
add_filter(‘the_title’, function ($title, $post_id) {
if (is_admin() || !is_singular(‘wpdmpro’) || !in_the_loop() || !is_main_query()) return $title;
if ((int)$post_id !== (int)get_queried_object_id()) return $title;
if (strpos($title, ‘wpdm-title-wrap’) !== false) return $title;

return ‘<div class=”container”><div class=”row”><div class=”col-lg-8 wpdm-title-wrap”>’ .
$title .
‘</div></div></div>’;
}, 10, 2);

Current status

WPDM singles now load correctly at /download/<slug>/. Example: https://complianceinsight.ca/download/press-release-2025-09-02/

Site styling restored (title + content aligned with container/row).

No more fatals. Logs show only benign PHP 8.2 notices from the theme’s Customizer notice class (Deprecated: Creation of dynamic property …).

Suggestions

WPDM resilience: Adding a defensive check around breadcrumb/taxonomy lookups for custom post types would help WPDM work out-of-the-box with themes that assume posts/categories.

Theme interaction doc: A short WPDM doc page on “Theme compatibility” (especially around breadcrumb hooks) would help other users avoid this.

Optional hook: A dedicated filter to let developers wrap WPDM singles in their theme’s grid without intercepting the_content would simplify compatibility work.

Happy to provide a staging URL or further debug info if you’d like to see the exact crash path in action.

Thanks for your continued work on WPDM—outside this theme-specific issue, the plugin has been solid.

#208379

Nayeem Riddhi
Moderator

Hello Doug Nix,

Hope you are well. Thanks for informing us. Are you talking about this theme compability, https://wordpress.org/themes/rara-business/? Please kindly check and let me know.

Thank you and regards

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.