Plugin Directory

Changeset 927089


Ignore:
Timestamp:
06/05/2014 12:14:20 PM (12 years ago)
Author:
michaeltyson
Message:

WP 3.9 compatibility fix, thanks to Sowmedia

Location:
custom-permalinks
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • custom-permalinks/trunk/custom-permalinks.php

    r869003 r927089  
    55Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
    66Description: Set custom permalinks on a per-post basis
    7 Version: 0.7.18
     7Version: 0.7.19
    88Author: Michael Tyson
    99Author URI: http://atastypixel.com/blog
     
    161161    if ( !$request ) return $query;
    162162   
    163     $sql = "SELECT $wpdb->posts.ID, $wpdb->postmeta.meta_value, $wpdb->posts.post_type FROM $wpdb->posts  ".
     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  ".
    164165                "LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE ".
    165166                "  meta_key = 'custom_permalink' AND ".
    166167                "  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)) ) ".
     168                "  ( LOWER(meta_value) = LEFT(LOWER('%s'), LENGTH(meta_value)) OR ".
     169                "    LOWER(meta_value) = LEFT(LOWER('%s'), LENGTH(meta_value)) ) ".
    169170                "  AND post_status != 'trash' AND post_type != 'nav_menu_item'".
    170171                " ORDER BY LENGTH(meta_value) DESC, ".
    171172                " FIELD(post_status,'publish','private','draft','auto-draft','inherit'),".
    172173                " FIELD(post_type,'post','page'),".
    173                 "$wpdb->posts.ID ASC  LIMIT 1";
     174                "$wpdb->posts.ID ASC  LIMIT 1",
     175            $request_noslash,
     176            $request_noslash."/"
     177            );
    174178
    175179    $posts = $wpdb->get_results($sql);
     
    512516function custom_permalinks_delete_permalink( $id ){
    513517    global $wpdb;
    514     $wpdb->query("DELETE FROM $wpdb->postmeta WHERE `meta_key` = 'custom_permalink' AND `post_id` = '".mysql_real_escape_string($id)."'");
     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));
    515520}
    516521
  • custom-permalinks/trunk/readme.txt

    r869003 r927089  
    44Tags: permalink, url, link, address, custom, redirect
    55Requires at least: 2.6
    6 Tested up to: 3.3.1
    7 Stable tag: 0.7.18
     6Tested up to: 3.9
     7Stable tag: 0.7.19
    88
    99Set custom permalinks on a per-post, per-tag or per-category basis.
     
    2929
    3030== Changelog ==
     31
     32= 0.7.19 =
     33
     34  * WP 3.9 compatibility fix, thanks to Sowmedia
    3135
    3236= 0.7.18 =
Note: See TracChangeset for help on using the changeset viewer.