Changeset 1431045
- Timestamp:
- 06/06/2016 01:06:59 AM (10 years ago)
- Location:
- custom-permalinks
- Files:
-
- 4 added
- 2 edited
-
tags/0.7.25 (added)
-
tags/0.7.25/custom-permalinks.php (added)
-
tags/0.7.25/index.html (added)
-
tags/0.7.25/readme.txt (added)
-
trunk/custom-permalinks.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
custom-permalinks/trunk/custom-permalinks.php
r1402771 r1431045 5 5 Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/ 6 6 Description: Set custom permalinks on a per-post basis 7 Version: 0.7.2 37 Version: 0.7.25 8 8 Author: Michael Tyson 9 9 Author URI: http://atastypixel.com/blog … … 162 162 163 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 ); 164 $sql = $wpdb->prepare("SELECT $wpdb->posts.ID, $wpdb->postmeta.meta_value, $wpdb->posts.post_type, $wpdb->posts.post_status 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."/"); 178 177 179 178 $posts = $wpdb->get_results($sql); … … 185 184 if ( $request_noslash == trim($posts[0]->meta_value,'/') ) 186 185 $_CPRegisteredURL = $request; 187 188 $originalUrl = preg_replace( '@/+@', '/', str_replace( trim( strtolower($posts[0]->meta_value),'/' ), 189 ( $posts[0]->post_type == 'page' ? 190 custom_permalinks_original_page_link($posts[0]->ID) 191 : custom_permalinks_original_post_link($posts[0]->ID) ), 192 strtolower($request_noslash) ) ); 186 187 if ( $posts[0]->post_status == 'draft' ) { 188 $originalUrl = "?p=" . $posts[0]->ID; 189 } else { 190 $originalUrl = preg_replace( '@/+@', '/', str_replace( trim( strtolower($posts[0]->meta_value),'/' ), 191 ( $posts[0]->post_type == 'page' ? 192 custom_permalinks_original_page_link($posts[0]->ID) 193 : custom_permalinks_original_post_link($posts[0]->ID) ), 194 strtolower($request_noslash) ) ); 195 } 193 196 } 194 197 -
custom-permalinks/trunk/readme.txt
r1402771 r1431045 4 4 Tags: permalink, url, link, address, custom, redirect 5 5 Requires at least: 2.6 6 Tested up to: 4.5 7 Stable tag: 0.7.2 46 Tested up to: 4.5.2 7 Stable tag: 0.7.25 8 8 9 9 Set custom permalinks on a per-post, per-tag or per-category basis. … … 29 29 30 30 == Changelog == 31 32 = 0.7.25 = 33 34 * Fixed draft preview issue 31 35 32 36 = 0.7.24 =
Note: See TracChangeset
for help on using the changeset viewer.