abindelli
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [Custom Permalinks] Custom permalink request $request_noslash QUERYHi,
that query is using the mysql LEFT function and in some situations can generate bad SEO situations.
Example:
– we have a page ‘father’ responding at http://mydomain/father/ (good http response code 200)
– but with all other pages under /father/xxxxx/ -> http://mydomain/father/xxxxx/ the query recuperates the father page and show it with wrong http response code 200 instead 404Is there a good reason why that query use the LEFT operator?
I suggest to use the follow query revisited:line 177 (on v 0.9.1)
or
line 172 (on v 0.9.2)$sql = $wpdb->prepare("SELECT $wpdb->posts.ID, $wpdb->postmeta.meta_value, $wpdb->posts.post_type, $wpdb->posts.post_status FROM $wpdb->posts ". "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE ". " meta_key = 'custom_permalink' AND ". " meta_value != '' AND ". " ( LOWER(meta_value) = LOWER('%s') OR ". " LOWER(meta_value) = LOWER('%s') ) ". " AND post_status != 'trash' AND post_type != 'nav_menu_item'". " ORDER BY LENGTH(meta_value) DESC, ". " FIELD(post_status,'publish','private','draft','auto-draft','inherit'),". " FIELD(post_type,'post','page'),". "$wpdb->posts.ID ASC LIMIT 1", $request_noslash, $request_noslash."/");
Viewing 1 replies (of 1 total)