Custom Permalinks - Version 0.7.19

Version Description

  • WP 3.9 compatibility fix, thanks to Sowmedia
Download this release

Release Info

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

Code changes from version 0.7.18 to 0.7.19

Files changed (3) hide show
  1. custom-permalinks.php +11 -6
  2. index.html +0 -0
  3. 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.18
8
  Author: Michael Tyson
9
  Author URI: http://atastypixel.com/blog
10
  */
@@ -160,17 +160,21 @@ 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
  " 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
 
@@ -511,7 +515,8 @@ function custom_permalinks_save_term($term, $permalink) {
511
  */
512
  function custom_permalinks_delete_permalink( $id ){
513
  global $wpdb;
514
- $wpdb->query("DELETE FROM $wpdb->postmeta WHERE `meta_key` = 'custom_permalink' AND `post_id` = '".mysql_real_escape_string($id)."'");
 
515
  }
516
 
517
  /**
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.19
8
  Author: Michael Tyson
9
  Author URI: http://atastypixel.com/blog
10
  */
160
 
161
  if ( !$request ) return $query;
162
 
163
+ // Queries are now WP3.9 compatible (by Steve from Sowmedia.nl)
164
+ $sql = $wpdb->prepare("SELECT $wpdb->posts.ID, $wpdb->postmeta.meta_value, $wpdb->posts.post_type FROM $wpdb->posts ".
165
  "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE ".
166
  " meta_key = 'custom_permalink' AND ".
167
  " meta_value != '' AND ".
168
+ " ( LOWER(meta_value) = LEFT(LOWER('%s'), LENGTH(meta_value)) OR ".
169
+ " LOWER(meta_value) = LEFT(LOWER('%s'), LENGTH(meta_value)) ) ".
170
  " AND post_status != 'trash' AND post_type != 'nav_menu_item'".
171
  " ORDER BY LENGTH(meta_value) DESC, ".
172
  " FIELD(post_status,'publish','private','draft','auto-draft','inherit'),".
173
  " FIELD(post_type,'post','page'),".
174
+ "$wpdb->posts.ID ASC LIMIT 1",
175
+ $request_noslash,
176
+ $request_noslash."/"
177
+ );
178
 
179
  $posts = $wpdb->get_results($sql);
180
 
515
  */
516
  function custom_permalinks_delete_permalink( $id ){
517
  global $wpdb;
518
+ // Queries are now WP3.9 compatible (by Steve from Sowmedia.nl)
519
+ $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE `meta_key` = 'custom_permalink' AND `post_id` = %d",$id));
520
  }
521
 
522
  /**
index.html CHANGED
File without changes
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.18
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.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
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.19
8
 
9
  Set custom permalinks on a per-post, per-tag or per-category basis.
10
 
29
 
30
  == Changelog ==
31
 
32
+ = 0.7.19 =
33
+
34
+ * WP 3.9 compatibility fix, thanks to Sowmedia
35
+
36
  = 0.7.18 =
37
 
38
  * Patch to address 404 errors when displaying a page/post that shares a permalink with a trashed page/post, thanks to Tor Johnson