Version Description
- Fixed Redirect Issue of Child Pages
Download this release
Release Info
Developer | sasiddiqui |
Plugin | Custom Permalinks |
Version | 1.2.10 |
Comparing to | |
See all releases |
Code changes from version 1.2.9 to 1.2.10
- custom-permalinks-main.php +1 -1
- custom-permalinks.php +1 -1
- frontend/class-custom-permalinks-frontend.php +34 -28
- readme.txt +5 -1
custom-permalinks-main.php
CHANGED
@@ -15,7 +15,7 @@ if ( ! function_exists( 'add_action' ) || ! function_exists( 'add_filter' ) ) {
|
|
15 |
exit();
|
16 |
}
|
17 |
|
18 |
-
define( 'CUSTOM_PERMALINKS_PLUGIN_VERSION', '1.2.
|
19 |
|
20 |
if ( ! defined( 'CUSTOM_PERMALINKS_PATH' ) ) {
|
21 |
define( 'CUSTOM_PERMALINKS_PATH', plugin_dir_path( __FILE__ ) );
|
15 |
exit();
|
16 |
}
|
17 |
|
18 |
+
define( 'CUSTOM_PERMALINKS_PLUGIN_VERSION', '1.2.10' );
|
19 |
|
20 |
if ( ! defined( 'CUSTOM_PERMALINKS_PATH' ) ) {
|
21 |
define( 'CUSTOM_PERMALINKS_PATH', plugin_dir_path( __FILE__ ) );
|
custom-permalinks.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Custom Permalinks
|
5 |
* Plugin URI: https://wordpress.org/plugins/custom-permalinks/
|
6 |
* Description: Set custom permalinks on a per-post basis
|
7 |
-
* Version: 1.2.
|
8 |
* Author: Sami Ahmed Siddiqui
|
9 |
* Author URI: https://www.custompermalinks.com
|
10 |
* Donate link: https://www.paypal.me/yasglobal
|
4 |
* Plugin Name: Custom Permalinks
|
5 |
* Plugin URI: https://wordpress.org/plugins/custom-permalinks/
|
6 |
* Description: Set custom permalinks on a per-post basis
|
7 |
+
* Version: 1.2.10
|
8 |
* Author: Sami Ahmed Siddiqui
|
9 |
* Author URI: https://www.custompermalinks.com
|
10 |
* Donate link: https://www.paypal.me/yasglobal
|
frontend/class-custom-permalinks-frontend.php
CHANGED
@@ -48,8 +48,7 @@ class Custom_Permalinks_Frontend {
|
|
48 |
return $query;
|
49 |
}
|
50 |
|
51 |
-
$ignore
|
52 |
-
$def_query = apply_filters( 'custom_permalinks_like_query', '__false' );
|
53 |
|
54 |
if ( '__true' === $ignore ) {
|
55 |
return $query;
|
@@ -74,20 +73,23 @@ class Custom_Permalinks_Frontend {
|
|
74 |
|
75 |
$posts = $wpdb->get_results( $sql );
|
76 |
|
77 |
-
if ( ! $posts
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
91 |
}
|
92 |
|
93 |
if ( $posts ) {
|
@@ -229,18 +231,22 @@ class Custom_Permalinks_Frontend {
|
|
229 |
$posts = $wpdb->get_results( $sql );
|
230 |
|
231 |
if ( ! $posts ) {
|
232 |
-
$
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
|
|
|
|
|
|
|
|
244 |
}
|
245 |
|
246 |
if ( ! isset( $posts[0]->ID ) || ! isset( $posts[0]->meta_value )
|
48 |
return $query;
|
49 |
}
|
50 |
|
51 |
+
$ignore = apply_filters( 'custom_permalinks_request_ignore', $request );
|
|
|
52 |
|
53 |
if ( '__true' === $ignore ) {
|
54 |
return $query;
|
73 |
|
74 |
$posts = $wpdb->get_results( $sql );
|
75 |
|
76 |
+
if ( ! $posts ) {
|
77 |
+
$def_query = apply_filters( 'custom_permalinks_like_query', '__false' );
|
78 |
+
if ( defined( 'POLYLANG_VERSION' ) || defined( 'AMP__VERSION' )
|
79 |
+
|| '__false' !== $def_query ) {
|
80 |
+
$sql = $wpdb->prepare( "SELECT p.ID, pm.meta_value, p.post_type, p.post_status FROM $wpdb->posts AS p " .
|
81 |
+
" LEFT JOIN $wpdb->postmeta AS pm ON (p.ID = pm.post_id) WHERE " .
|
82 |
+
" meta_key = 'custom_permalink' AND meta_value != '' AND " .
|
83 |
+
" ( LOWER(meta_value) = LEFT(LOWER('%s'), LENGTH(meta_value)) OR " .
|
84 |
+
" LOWER(meta_value) = LEFT(LOWER('%s'), LENGTH(meta_value)) ) " .
|
85 |
+
" AND post_status != 'trash' AND post_type != 'nav_menu_item'" .
|
86 |
+
" ORDER BY LENGTH(meta_value) DESC, " .
|
87 |
+
" FIELD(post_status,'publish','private','draft','auto-draft','inherit')," .
|
88 |
+
" FIELD(post_type,'post','page'), p.ID ASC LIMIT 1",
|
89 |
+
$request_noslash, $request_noslash . "/" );
|
90 |
+
|
91 |
+
$posts = $wpdb->get_results( $sql );
|
92 |
+
}
|
93 |
}
|
94 |
|
95 |
if ( $posts ) {
|
231 |
$posts = $wpdb->get_results( $sql );
|
232 |
|
233 |
if ( ! $posts ) {
|
234 |
+
$def_query = apply_filters( 'custom_permalinks_like_query', '__false' );
|
235 |
+
if ( defined( 'POLYLANG_VERSION' ) || defined( 'AMP__VERSION' )
|
236 |
+
|| '__false' !== $def_query ) {
|
237 |
+
$sql = $wpdb->prepare( "SELECT p.ID, pm.meta_value, p.post_type, p.post_status FROM $wpdb->posts AS p " .
|
238 |
+
" LEFT JOIN $wpdb->postmeta AS pm ON (p.ID = pm.post_id) WHERE " .
|
239 |
+
" meta_key = 'custom_permalink' AND meta_value != '' AND " .
|
240 |
+
" ( LOWER(meta_value) = LEFT(LOWER('%s'), LENGTH(meta_value)) OR " .
|
241 |
+
" LOWER(meta_value) = LEFT(LOWER('%s'), LENGTH(meta_value)) ) " .
|
242 |
+
" AND post_status != 'trash' AND post_type != 'nav_menu_item'" .
|
243 |
+
" ORDER BY LENGTH(meta_value) DESC, " .
|
244 |
+
" FIELD(post_status,'publish','private','draft','auto-draft','inherit')," .
|
245 |
+
" FIELD(post_type,'post','page'), p.ID ASC LIMIT 1",
|
246 |
+
$request_noslash, $request_noslash . "/" );
|
247 |
+
|
248 |
+
$posts = $wpdb->get_results( $sql );
|
249 |
+
}
|
250 |
}
|
251 |
|
252 |
if ( ! isset( $posts[0]->ID ) || ! isset( $posts[0]->meta_value )
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.paypal.me/yasglobal
|
|
5 |
Tags: permalink, url, link, address, custom, redirect, custom post type
|
6 |
Requires at least: 2.6
|
7 |
Tested up to: 4.9
|
8 |
-
Stable tag: 1.2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -75,6 +75,10 @@ The support from the users that love Custom Permalinks is huge. You can support
|
|
75 |
|
76 |
== Changelog ==
|
77 |
|
|
|
|
|
|
|
|
|
78 |
= 1.2.9 =
|
79 |
|
80 |
* Enhancements
|
5 |
Tags: permalink, url, link, address, custom, redirect, custom post type
|
6 |
Requires at least: 2.6
|
7 |
Tested up to: 4.9
|
8 |
+
Stable tag: 1.2.10
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
75 |
|
76 |
== Changelog ==
|
77 |
|
78 |
+
= 1.2.10 =
|
79 |
+
|
80 |
+
* Fixed Redirect Issue of Child Pages
|
81 |
+
|
82 |
= 1.2.9 =
|
83 |
|
84 |
* Enhancements
|