[wp-hackers] optimization tip and may be bug report

Martin Lazarov martin at lazarov.bg
Mon Nov 15 13:25:18 UTC 2010


Hi all,
may be it's good idea to replace this in wp-includes/query.php:1759
if ( '' != $q['name'] ) {

width this:

if ( '' != $q['name'] && !$q['p']) {

This way the query will not contains post_name='...' if there is post
ID passed. This will make query faster, because it will use only
wp_posts primary key instead of making query by index and table scan.


End the bug that i found is:
some months ago i installed fresh wordpress on the server that doesn't
have php mb_string functions, so the function
sanitize_title_with_dashes (wp-includes/formatting.php:814) just
doesn't do str to lower title values. But week ago i installed the mb
string library for php and the old slugs stop working. That's because
this code (part of wp-includes/formatting.php:814)  now works:

if (function_exists('mb_strtolower')) {
	$title = mb_strtolower($title, 'UTF-8');
}

Adding the patch at the top of this mail solves the problem for me.


More information about the wp-hackers mailing list