Warning: mysql_real_escape_string() and Custom Permalinks 0.7.18 with PHP 5.5
-
If you have this error with WordPress 3.9 :
Warning: mysql_real_escape_string(): No such file or directory in /.../wp-content/plugins/custom-permalinks/custom-permalinks.php on line 167
Edit this file : wp-content/plugins/custom-permalinks/custom-permalinks.php
Comment this code :
/* $sql = "SELECT $wpdb->posts.ID, $wpdb->postmeta.meta_value, $wpdb->posts.post_type 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) = LEFT(LOWER('".mysql_real_escape_string($request_noslash)."'), LENGTH(meta_value)) OR ". " LOWER(meta_value) = LEFT(LOWER('".mysql_real_escape_string($request_noslash."/")."'), LENGTH(meta_value)) ) ". " 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"; $posts = $wpdb->get_results($sql); */
And add this after :
$sql = "SELECT $wpdb->posts.ID, $wpdb->postmeta.meta_value, $wpdb->posts.post_type 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) = LEFT(LOWER('%s'), LENGTH(meta_value)) OR ". " LOWER(meta_value) = LEFT(LOWER('%s'), LENGTH(meta_value)) ) ". " 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"; $posts = $wpdb->get_var( $wpdb->prepare( $sql, $request_noslash, // an unescaped string (function will do the sanitization for you) $request_noslash // an untrusted integer (function will do the sanitization for you) ) );
- The topic ‘Warning: mysql_real_escape_string() and Custom Permalinks 0.7.18 with PHP 5.5’ is closed to new replies.