WordPress.org

Ready to get started?Download WordPress

Forums

Self Hosted Plugins
[resolved] What to do if your README has shortcodes. (1 post)

  1. topquarky
    Member
    Plugin Author

    Posted 3 years ago #

    I came across this one on my own site and thought I'd share the fix.

    I'm hosting plugins on my site using Self Hosted Plugins. That same site has a couple of those plugins activated (for demos etc.). When Self Hosted Plugins rendered the plugin description page, it filtered the content through do_shortcode. It tried to expand all of my example shortcodes.

    To fix this, I added the following to my theme's functions.php file. The code simply removes the do_shortcode filter on the_content:

    add_action( 'pre_get_posts', 'topquark_massage_spoof',99 );
    function topquark_massage_spoof(){
    	// I don't want shortcodes to get expanded on this page (so I can put shortcodes in the readme on a site)
    	// that has the plugins activated
    	if (defined('SHP_SPOOFED_PLUGIN_PAGE')){
    		remove_filter('the_content','do_shortcode',11);
    	}
    }

    Cheers
    [sig moderated as per the Forum Rules]

    http://wordpress.org/extend/plugins/self-hosted-plugins/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic