Title: Total theme compatibility
Last modified: May 11, 2026

---

# Total theme compatibility

 *  [Joshua Fredrickson](https://wordpress.org/support/users/joshf/)
 * (@joshf)
 * [6 days, 7 hours ago](https://wordpress.org/support/topic/total-theme-compatibility/)
 * I ran into a compatibility gap with Total Theme / Total Theme Core and wanted
   to share both the root cause and a working fix in case it’s useful for a future
   update.
 * **The problem**
 * The `hcbrwpb_visible_for_roles` attribute has no effect on `vcex_*` shortcodes(
   e.g. `vcex_flex_container`, `vcex_heading`, `vcex_button`, etc.). Those are Total
   Theme Core’s own elements and they never pass through WPBakery’s `vc_shortcode_output`
   filter, which is the only hook this plugin uses.
 * Total Theme Core registers `vcex_*` shortcodes via WordPress’s native `add_shortcode`
   and renders them through its own `Shortcode_Abstract::output()` method. That 
   method returns HTML directly without firing `vc_shortcode_output`.
 * **The fix**
 * Total Theme Core has its own pre-render filter called `vcex_maybe_display_shortcode`.
   It fires a filterable boolean before any `vcex_*` element renders, and at that
   point the raw shortcode attributes, including `hcbrwpb_visible_for_roles`, are
   still intact (before they get stripped by `vcex_shortcode_atts()`).
 * Hooking there applies the same role logic to all `vcex_*` elements. Here’s a 
   drop-in snippet (child theme `functions.php` or a mu-plugin):
 *     ```wp-block-code
       <?php/** * Extends "Hide Content by Role for WPBakery" to cover vcex_* shortcodes. * * The plugin hooks vc_shortcode_output, which WPBakery fires only for its own * native elements. Total Theme Core's vcex_* elements bypass that filter and * render via Shortcode_Abstract::output(), which calls vcex_maybe_display_shortcode * before doing anything else — so we hook there instead. */add_filter('vcex_maybe_display_shortcode', function (bool $display, string $tag, array $atts): bool {    if (!$display || empty($atts['hcbrwpb_visible_for_roles'])) {        return $display;    }    $allowed_roles = array_map('trim', explode(',', $atts['hcbrwpb_visible_for_roles']));    if (in_array('logged_out', $allowed_roles, true) && !is_user_logged_in()) {        return true;    }    $user = get_userdata(get_current_user_id());    if ($user) {        foreach ($allowed_roles as $role) {            if (in_array($role, (array) $user->roles, true)) {                return true;            }        }    }    return false;}, 10, 3);
       ```
   
 * The original `vc_shortcode_output` hook still handles WPBakery-native elements(`
   vc_row`, `vc_column`, etc.) as expected. This just fills the gap for Total Theme
   Core’s elements.
 * Ideally this (or an equivalent integration file) could ship in the plugin’s `/
   integrations/` folder alongside the existing `salient.php`.

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ftotal-theme-compatibility%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/hide-content-by-role-for-wpbakery/assets/icon-256x256.png?
   rev=2202559)
 * [Hide Content by User Role for WPBakery](https://wordpress.org/plugins/hide-content-by-role-for-wpbakery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hide-content-by-role-for-wpbakery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hide-content-by-role-for-wpbakery/)
 * [Active Topics](https://wordpress.org/support/plugin/hide-content-by-role-for-wpbakery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hide-content-by-role-for-wpbakery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hide-content-by-role-for-wpbakery/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Joshua Fredrickson](https://wordpress.org/support/users/joshf/)
 * Last activity: [6 days, 7 hours ago](https://wordpress.org/support/topic/total-theme-compatibility/)
 * Status: not resolved