Support » Plugin: CMB2 » Blank lines in Feed Rss

  • Resolved Kezily

    (@kezily)


    Hello,

    The CMB2 is breaking my Feed RSS adding blank lines.
    When I deactivate the CMB2, the Feed RSS works fine.

    How can I fix this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi @kezily,

    It sounds like you are using a plugin, or more likely a theme that either has CMB2 bundled in with it, or at least lists CMB2 as a required/recommended plugin and is trying to use it somehow.

    Out of the box and on its own, CMB2 shouldn’t affect feeds because it’s not going to do anything on its own until someone explicitly starts creating metaboxes or option pages with it.

    @kezily Just tell to your dev (or do it yourself) to add this code in the proper file of your plugin location :

    function custom_is_plugin_active( $plugin ) {
        return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || custom_is_plugin_active_for_network( $plugin );
    }
    
    function custom_is_plugin_active_for_network( $plugin ) {
        if ( ! is_multisite() ) {
            return false;
        }
    
        $plugins = get_site_option( 'active_sitewide_plugins' );
        if ( isset( $plugins[ $plugin ] ) ) {
            return true;
        }
    
        return false;
    }
    
    if( !custom_is_plugin_active( WP_PLUGIN_DIR . '/cmb2/init.php' )) {
    	if ( file_exists( YOUR_PLUGIN_PATH . '/cmb2/init.php' ) ) {
    		require_once YOUR_PLUGIN_PATH . '/cmb2/init.php';
    	} elseif ( file_exists( YOUR_PLUGIN_PATH . '/CMB2/init.php' ) ) {
    		require_once YOUR_PLUGIN_PATH . '/CMB2/init.php';
    	}
    }

    This code is to adapt to the plugin itself.

    A more simple solution, to wrap under conditional statement, could be done with wp_deregister_style( 'cmb2-styles' ); :

    add_action( 'admin_enqueue_scripts', function () {
    // If statement made by you, needed to don't break CSS of your plugin
        wp_deregister_style( 'cmb2-styles' );
    // endif
    });

    This will deregister cmb2 stylesheet load and will solve your issue.

    • This reply was modified 1 year, 3 months ago by moxymore.
    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    https://github.com/CMB2/CMB2/wiki/Basic-Usage#caveats-for-bundling-and-including-cmb2

    Chances are at the moment that the last reply above does not apply. It’s not a loading issue and styles wouldn’t, or at least shouldn’t, be creeping into RSS feed markup.

    Still waiting on any feedback from the original poster about the situation.

    Thank you @moxymore, but the problem is a conlict between CMB2 and Yoast SEO.

    I excluded CMB2 and installed another plugin, now everything is working.

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Still has me curious what was causing things because as mentioned previously, simply having CMB2 installed and active shouldn’t be causing any output anywhere, unless the library is being used somewhere/somehow.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Blank lines in Feed Rss’ is closed to new replies.