With WP Super Cache 1.0, the author Donncha added a feature of preloading taxonomies (tags, categories) and custom post content. But if you run a multisite WordPress in sub-directory mode, this feature could be failure in the main blog.
Been fixed in WPSC 1.3.2, using
$out .= get_term_link( $term ). "\n"; to do the trick.
This bug re-accured in WPSC version 1.3 and has not been fixed yet.
This bug had been fixed in WPSC version 1.2.
As we know that WordPress uses
blog before pre-base of tags, categories and posts to avoid url conflicts in main blog (via). The urls looks like:
And WP Super Cache (WPSC) doesn’t treat this well while preloading tags and categories. When preloading taxonomies, WPSC uses the following url pattern to get tags and categories pages:
Here is a snapshot of this:
This will not cause too much problems but it’s not elegant.
I will inform the author about this. Before it’s been solved, here are some tips maybe helpful:
1. Do not check option of “Preload tags, categories and other taxonomies”.
This option lies in “Preload” tab of “WP Super Cache Settings” page. (Recommended)
2. Fix the source code of this plugin as following description ( NOT recommended).
/wp-content/plugins/wp-super-cache/wp-cache.php file with a text editor.
Find line of below (about 40 lines after the search result line) :
$taxonomies = apply_filters( 'wp_cache_preload_taxonomies', array( 'post_tag' => 'tag', 'category' => 'category' ) );
Add the following code snippet right after this line:
/** * * fix taxonomies url error, 2012.03.12 by Haoxian Zeng * * and line 2786 */ $main_blog_taxonomies_base = ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true && is_main_blog() ) ? 'blog/' : '';
Then find the folowing code line ( about 10 lines below),
$out .= site_url( $path . "/" . $term->slug . "/" ) . "\n";
change it to,
$out .= site_url( $main_blog_taxonomies_base . $path . "/" . $term->slug . "/" ) . "\n";
- This bug affects only sub-directory mode of multisite WordPress.
- Even use the second way to fix the code, WPSC only preloads the first 50 tag-pages because of the following line:
$rows = array_splice( $details, 0, 50 );
- And then stop working which I think is another bug.