Version Description
- Fixed draft preview issue
Download this release
Release Info
Developer | michaeltyson |
Plugin | Custom Permalinks |
Version | 0.7.25 |
Comparing to | |
See all releases |
Code changes from version 0.7.24 to 0.7.25
- custom-permalinks.php +24 -21
- readme.txt +6 -2
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.
|
8 |
Author: Michael Tyson
|
9 |
Author URI: http://atastypixel.com/blog
|
10 |
Text Domain: custom-permalinks
|
@@ -161,20 +161,19 @@ function custom_permalinks_request($query) {
|
|
161 |
if ( !$request ) return $query;
|
162 |
|
163 |
// Queries are now WP3.9 compatible (by Steve from Sowmedia.nl)
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
);
|
178 |
|
179 |
$posts = $wpdb->get_results($sql);
|
180 |
|
@@ -184,12 +183,16 @@ function custom_permalinks_request($query) {
|
|
184 |
// Preserve this url for later if it's the same as the permalink (no extra stuff)
|
185 |
if ( $request_noslash == trim($posts[0]->meta_value,'/') )
|
186 |
$_CPRegisteredURL = $request;
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
|
|
193 |
}
|
194 |
|
195 |
if ( $originalUrl === NULL ) {
|
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.25
|
8 |
Author: Michael Tyson
|
9 |
Author URI: http://atastypixel.com/blog
|
10 |
Text Domain: custom-permalinks
|
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, $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."/");
|
|
|
177 |
|
178 |
$posts = $wpdb->get_results($sql);
|
179 |
|
183 |
// Preserve this url for later if it's the same as the permalink (no extra stuff)
|
184 |
if ( $request_noslash == trim($posts[0]->meta_value,'/') )
|
185 |
$_CPRegisteredURL = $request;
|
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 |
+
}
|
196 |
}
|
197 |
|
198 |
if ( $originalUrl === NULL ) {
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
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: 4.5
|
7 |
-
Stable tag: 0.7.
|
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.24 =
|
33 |
|
34 |
* Fixed a problem with page URLs
|
3 |
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: 4.5.2
|
7 |
+
Stable tag: 0.7.25
|
8 |
|
9 |
Set custom permalinks on a per-post, per-tag or per-category basis.
|
10 |
|
29 |
|
30 |
== Changelog ==
|
31 |
|
32 |
+
= 0.7.25 =
|
33 |
+
|
34 |
+
* Fixed draft preview issue
|
35 |
+
|
36 |
= 0.7.24 =
|
37 |
|
38 |
* Fixed a problem with page URLs
|