• When using MarketPress (from WPMUDEV), a few issues arise:

    1. Store / Checkout Titles does not get modified. This is due to MarketPress filtering titles with a priority of 19, which is after WP SEO’s filter.
    2. Notices may appear on Store pages when debugging is on. This is mainly caused by MarketPress’ get_queried_object does not have an ID or query_var property (as being requested by WP SEO class-frontend.php on line 174 and 180 respectivly). All MarketPress pages are “is_singular”

    Issue 1 was resolved by adding the following to my theme (recommended creating a child theme for upgrading reasons):

    add_filter( 'wp_title', 'theme_fix_mp_title', 20, 3 );// Note 1
    function theme_fix_mp_title($title, $sep = '|', $loc = 'left'){ // Note 2
    	global $mp;
    	if(class_exists('MarketPress') && $mp->is_shop_page){ // Note 3
    		$sitename = get_bloginfo('name','display'); // Note 4
    		$new_sep = "—"; // Note 5
    		$title = trim(str_replace($sep,$new_sep,$title));
    		if($loc == 'left'){ // Note 6
    			$title = $sitename.' '.$title;
    		}else{
    			$title = $title.' '.$sitename;
    		}
    	}
    	return $title;
    }

    Notes:

    1. We need to be at priority 20 to be after MarketPress’ filter; we also need all 3 arguments
    2. The seperator supplied here will be what MarketPress used, therefore we can replace it.
    3. We need to make sure we only modify MarketPress page titles
    4. We now get the website name (you can change this to whatever you like)
    5. We define a new seperator (unless you want to keep your existing seperator; I recomment that it is the same format as what WP SEO use)
    6. Now depending on the location, we either append or prependthe sitename to the title

    The second issue can only be fixed by adding a check in WP SEO to skip MarketPress pages.

    Jaco

    https://wordpress.org/plugins/wordpress-seo/

  • The topic ‘MarketPress Compatibility’ is closed to new replies.