• If you have many pages in your blog, All in One SEO Pack’s aioseop_list_pages() issues many queries to the database because the plugin has to fetch the metadata for every page returned by wp_list_pages(). This can be slow. The better alternative is to use update_meta_cache() before doing preg_replace. See the patch below:

    --- all_in_one_seo_pack.orig.php	2009-12-16 09:37:23.000000000 +0200
    +++ all_in_one_seo_pack.php	2009-12-17 06:00:32.000000000 +0200
    @@ -632,7 +632,7 @@
     }
    
     if($aioseop_options['aiosp_enabled']){
    -	add_action('wp_list_pages', 'aioseop_list_pages');
    +	add_filter('wp_list_pages', 'aioseop_list_pages');
     	remove_action( 'wp_head', 'rel_canonical' );
     }
    
    @@ -688,11 +688,17 @@
    
     // The following two functions copied entirely and modified slightly from Sarah G's Page Menu Editor, http://wordpress.org/extend/plugins/page-menu-editor/
     function aioseop_list_pages($content){
    -		$url = preg_replace(array('/\//', '/\./', '/\-/'), array('\/', '\.', '\-'), get_option('siteurl'));
    +		$matches = array();
    +		if (preg_match_all('/<li class="page_item page-item-(\d+)/i', $content, $matches)) {
    +			update_postmeta_cache(array_values($matches[1]));
    +			unset($matches);
     		$pattern = '/<li class="page_item page-item-(\d+)([^\"]*)"><a href=\"([^\"]+)" title="([^\"]+)">([^<]+)<\/a>/i';
     		return preg_replace_callback($pattern, "aioseop_filter_callback", $content);
     	}
    
    +		return $content;
    +	}
    +
     function aioseop_filter_callback($matches) {
     	global $wpdb;
     	if ($matches[1] && !empty($matches[1])) $postID = $matches[1];

    Details and explanations (in Russian) are here and here.

    http://wordpress.org/extend/plugins/all-in-one-seo-pack/

  • The topic ‘[Plugin: All in One SEO Pack] aioseop_list_pages() is very ineffective’ is closed to new replies.