Custom Permalinks - Version 0.7.18

Version Description

  • Patch to address 404 errors when displaying a page/post that shares a permalink with a trashed page/post, thanks to Tor Johnson
Download this release

Release Info

Developer michaeltyson
Plugin Icon Custom Permalinks
Version 0.7.18
Comparing to
See all releases

Code changes from version 0.7.17 to 0.7.18

Files changed (2) hide show
  1. custom-permalinks.php +12 -8
  2. readme.txt +5 -1
custom-permalinks.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Permalinks
4
  Plugin URI: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
5
  Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
6
  Description: Set custom permalinks on a per-post basis
7
- Version: 0.7.16
8
  Author: Michael Tyson
9
  Author URI: http://atastypixel.com/blog
10
  */
@@ -160,13 +160,17 @@ function custom_permalinks_request($query) {
160
 
161
  if ( !$request ) return $query;
162
 
163
- $sql = "SELECT $wpdb->posts.ID, $wpdb->postmeta.meta_value, $wpdb->posts.post_type FROM $wpdb->posts ".
164
- "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE ".
165
- " meta_key = 'custom_permalink' AND ".
166
- " meta_value != '' AND ".
167
- " ( LOWER(meta_value) = LEFT(LOWER('".mysql_real_escape_string($request_noslash)."'), LENGTH(meta_value)) OR ".
168
- " LOWER(meta_value) = LEFT(LOWER('".mysql_real_escape_string($request_noslash."/")."'), LENGTH(meta_value)) ) ".
169
- "ORDER BY LENGTH(meta_value) DESC LIMIT 1";
 
 
 
 
170
 
171
  $posts = $wpdb->get_results($sql);
172
 
4
  Plugin URI: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
5
  Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
6
  Description: Set custom permalinks on a per-post basis
7
+ Version: 0.7.18
8
  Author: Michael Tyson
9
  Author URI: http://atastypixel.com/blog
10
  */
160
 
161
  if ( !$request ) return $query;
162
 
163
+ $sql = "SELECT $wpdb->posts.ID, $wpdb->postmeta.meta_value, $wpdb->posts.post_type FROM $wpdb->posts ".
164
+ "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE ".
165
+ " meta_key = 'custom_permalink' AND ".
166
+ " meta_value != '' AND ".
167
+ " ( LOWER(meta_value) = LEFT(LOWER('".mysql_real_escape_string($request_noslash)."'), LENGTH(meta_value)) OR ".
168
+ " LOWER(meta_value) = LEFT(LOWER('".mysql_real_escape_string($request_noslash."/")."'), LENGTH(meta_value)) ) ".
169
+ " AND post_status != 'trash' AND post_type != 'nav_menu_item'".
170
+ " ORDER BY LENGTH(meta_value) DESC, ".
171
+ " FIELD(post_status,'publish','private','draft','auto-draft','inherit'),".
172
+ " FIELD(post_type,'post','page'),".
173
+ "$wpdb->posts.ID ASC LIMIT 1";
174
 
175
  $posts = $wpdb->get_results($sql);
176
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
4
  Tags: permalink, url, link, address, custom, redirect
5
  Requires at least: 2.6
6
  Tested up to: 3.3.1
7
- Stable tag: 0.7.17
8
 
9
  Set custom permalinks on a per-post, per-tag or per-category basis.
10
 
@@ -29,6 +29,10 @@ within that category.
29
 
30
  == Changelog ==
31
 
 
 
 
 
32
  = 0.7.17 =
33
 
34
  * Patch to address SSL problems, thanks to Amin Mirzaee
4
  Tags: permalink, url, link, address, custom, redirect
5
  Requires at least: 2.6
6
  Tested up to: 3.3.1
7
+ Stable tag: 0.7.18
8
 
9
  Set custom permalinks on a per-post, per-tag or per-category basis.
10
 
29
 
30
  == Changelog ==
31
 
32
+ = 0.7.18 =
33
+
34
+ * Patch to address 404 errors when displaying a page/post that shares a permalink with a trashed page/post, thanks to Tor Johnson
35
+
36
  = 0.7.17 =
37
 
38
  * Patch to address SSL problems, thanks to Amin Mirzaee