Version Description
- Fixed issues of Filters and Actions (Replaces 'edit_files' with 10)
Download this release
Release Info
Developer | sasiddiqui |
Plugin | Custom Permalinks |
Version | 0.9.1 |
Comparing to | |
See all releases |
Code changes from version 0.9 to 0.9.1
- custom-permalinks.php +30 -30
- readme.txt +5 -1
custom-permalinks.php
CHANGED
@@ -5,9 +5,9 @@
|
|
5 |
* Plugin URI: https://wordpress.org/plugins/custom-permalinks/
|
6 |
* Donate link: https://www.paypal.me/yasglobal
|
7 |
* Description: Set custom permalinks on a per-post basis
|
8 |
-
* Version: 0.9
|
9 |
-
* Author:
|
10 |
-
* Author URI:
|
11 |
* Text Domain: custom-permalinks
|
12 |
*/
|
13 |
|
@@ -255,11 +255,11 @@ function custom_permalinks_request($query) {
|
|
255 |
}
|
256 |
|
257 |
// Re-run the filter, now with original environment in place
|
258 |
-
remove_filter( 'request', 'custom_permalinks_request',
|
259 |
global $wp;
|
260 |
$wp->parse_request();
|
261 |
$query = $wp->query_vars;
|
262 |
-
add_filter( 'request', 'custom_permalinks_request',
|
263 |
|
264 |
// Restore values
|
265 |
$_SERVER['REQUEST_URI'] = $oldRequestUri; $_SERVER['QUERY_STRING'] = $oldQueryString;
|
@@ -695,16 +695,16 @@ function custom_permalinks_admin_rows() {
|
|
695 |
* @since 0.1
|
696 |
*/
|
697 |
function custom_permalinks_original_post_link($post_id) {
|
698 |
-
remove_filter( 'post_link', 'custom_permalinks_post_link',
|
699 |
-
remove_filter( 'post_type_link', 'custom_permalinks_post_link',
|
700 |
|
701 |
require_once ABSPATH . '/wp-admin/includes/post.php';
|
702 |
list( $permalink, $post_name ) = get_sample_permalink( $post_id );
|
703 |
$permalink = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
|
704 |
$permalink = ltrim(str_replace(home_url(), '', $permalink), '/');
|
705 |
|
706 |
-
add_filter( 'post_link', 'custom_permalinks_post_link',
|
707 |
-
add_filter( 'post_type_link', 'custom_permalinks_post_link',
|
708 |
|
709 |
return $permalink;
|
710 |
}
|
@@ -716,16 +716,16 @@ function custom_permalinks_original_post_link($post_id) {
|
|
716 |
* @since 0.4
|
717 |
*/
|
718 |
function custom_permalinks_original_page_link($post_id) {
|
719 |
-
remove_filter( 'page_link', 'custom_permalinks_page_link',
|
720 |
-
remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash',
|
721 |
|
722 |
require_once ABSPATH . '/wp-admin/includes/post.php';
|
723 |
list( $permalink, $post_name ) = get_sample_permalink( $post_id );
|
724 |
$permalink = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
|
725 |
$permalink = ltrim(str_replace(home_url(), '', $permalink), '/');
|
726 |
|
727 |
-
add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash',
|
728 |
-
add_filter( 'page_link', 'custom_permalinks_page_link',
|
729 |
return $permalink;
|
730 |
}
|
731 |
|
@@ -736,11 +736,11 @@ function custom_permalinks_original_page_link($post_id) {
|
|
736 |
* @since 0.1
|
737 |
*/
|
738 |
function custom_permalinks_original_tag_link($tag_id) {
|
739 |
-
remove_filter( 'tag_link', 'custom_permalinks_term_link',
|
740 |
-
remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash',
|
741 |
$originalPermalink = ltrim(str_replace(home_url(), '', get_tag_link($tag_id)), '/');
|
742 |
-
add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash',
|
743 |
-
add_filter( 'tag_link', 'custom_permalinks_term_link',
|
744 |
return $originalPermalink;
|
745 |
}
|
746 |
|
@@ -751,11 +751,11 @@ function custom_permalinks_original_tag_link($tag_id) {
|
|
751 |
* @since 0.1
|
752 |
*/
|
753 |
function custom_permalinks_original_category_link($category_id) {
|
754 |
-
remove_filter( 'category_link', 'custom_permalinks_term_link',
|
755 |
-
remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash',
|
756 |
$originalPermalink = ltrim(str_replace(home_url(), '', get_category_link($category_id)), '/');
|
757 |
-
add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash',
|
758 |
-
add_filter( 'category_link', 'custom_permalinks_term_link',
|
759 |
return $originalPermalink;
|
760 |
}
|
761 |
|
@@ -826,20 +826,20 @@ function custom_permalinks_check_conflicts($requested_url = '') {
|
|
826 |
|
827 |
if (function_exists("add_action") && function_exists("add_filter")) {
|
828 |
add_action( 'template_redirect', 'custom_permalinks_redirect', 5 );
|
829 |
-
add_filter( 'post_link', 'custom_permalinks_post_link',
|
830 |
-
add_filter( 'post_type_link', 'custom_permalinks_post_link',
|
831 |
-
add_filter( 'page_link', 'custom_permalinks_page_link',
|
832 |
-
add_filter( 'tag_link', 'custom_permalinks_term_link',
|
833 |
-
add_filter( 'category_link', 'custom_permalinks_term_link',
|
834 |
-
add_filter( 'request', 'custom_permalinks_request',
|
835 |
-
add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash',
|
836 |
|
837 |
if (function_exists("get_bloginfo")) {
|
838 |
$v = explode('.', get_bloginfo('version'));
|
839 |
}
|
840 |
|
841 |
if ( $v[0] >= 2 ) {
|
842 |
-
add_filter( 'get_sample_permalink_html', 'custom_permalink_get_sample_permalink_html',
|
843 |
} else {
|
844 |
add_action( 'edit_form_advanced', 'custom_permalinks_post_options' );
|
845 |
add_action( 'edit_page_form', 'custom_permalinks_page_options' );
|
@@ -854,7 +854,7 @@ if (function_exists("add_action") && function_exists("add_filter")) {
|
|
854 |
add_action( 'edited_category', 'custom_permalinks_save_category' );
|
855 |
add_action( 'create_post_tag', 'custom_permalinks_save_tag' );
|
856 |
add_action( 'create_category', 'custom_permalinks_save_category' );
|
857 |
-
add_action( 'delete_post', 'custom_permalinks_delete_permalink',
|
858 |
add_action( 'delete_post_tag', 'custom_permalinks_delete_term' );
|
859 |
add_action( 'delete_post_category', 'custom_permalinks_delete_term' );
|
860 |
add_action( 'admin_head', 'custom_permalinks_setup_admin_head' );
|
5 |
* Plugin URI: https://wordpress.org/plugins/custom-permalinks/
|
6 |
* Donate link: https://www.paypal.me/yasglobal
|
7 |
* Description: Set custom permalinks on a per-post basis
|
8 |
+
* Version: 0.9.1
|
9 |
+
* Author: Michael Tyson
|
10 |
+
* Author URI: http://atastypixel.com/blog
|
11 |
* Text Domain: custom-permalinks
|
12 |
*/
|
13 |
|
255 |
}
|
256 |
|
257 |
// Re-run the filter, now with original environment in place
|
258 |
+
remove_filter( 'request', 'custom_permalinks_request', 10, 1 );
|
259 |
global $wp;
|
260 |
$wp->parse_request();
|
261 |
$query = $wp->query_vars;
|
262 |
+
add_filter( 'request', 'custom_permalinks_request', 10, 1 );
|
263 |
|
264 |
// Restore values
|
265 |
$_SERVER['REQUEST_URI'] = $oldRequestUri; $_SERVER['QUERY_STRING'] = $oldQueryString;
|
695 |
* @since 0.1
|
696 |
*/
|
697 |
function custom_permalinks_original_post_link($post_id) {
|
698 |
+
remove_filter( 'post_link', 'custom_permalinks_post_link', 10, 3 ); // original hook
|
699 |
+
remove_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );
|
700 |
|
701 |
require_once ABSPATH . '/wp-admin/includes/post.php';
|
702 |
list( $permalink, $post_name ) = get_sample_permalink( $post_id );
|
703 |
$permalink = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
|
704 |
$permalink = ltrim(str_replace(home_url(), '', $permalink), '/');
|
705 |
|
706 |
+
add_filter( 'post_link', 'custom_permalinks_post_link', 10, 3 ); // original hook
|
707 |
+
add_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );
|
708 |
|
709 |
return $permalink;
|
710 |
}
|
716 |
* @since 0.4
|
717 |
*/
|
718 |
function custom_permalinks_original_page_link($post_id) {
|
719 |
+
remove_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );
|
720 |
+
remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
|
721 |
|
722 |
require_once ABSPATH . '/wp-admin/includes/post.php';
|
723 |
list( $permalink, $post_name ) = get_sample_permalink( $post_id );
|
724 |
$permalink = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
|
725 |
$permalink = ltrim(str_replace(home_url(), '', $permalink), '/');
|
726 |
|
727 |
+
add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
|
728 |
+
add_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );
|
729 |
return $permalink;
|
730 |
}
|
731 |
|
736 |
* @since 0.1
|
737 |
*/
|
738 |
function custom_permalinks_original_tag_link($tag_id) {
|
739 |
+
remove_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );
|
740 |
+
remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
|
741 |
$originalPermalink = ltrim(str_replace(home_url(), '', get_tag_link($tag_id)), '/');
|
742 |
+
add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
|
743 |
+
add_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );
|
744 |
return $originalPermalink;
|
745 |
}
|
746 |
|
751 |
* @since 0.1
|
752 |
*/
|
753 |
function custom_permalinks_original_category_link($category_id) {
|
754 |
+
remove_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );
|
755 |
+
remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
|
756 |
$originalPermalink = ltrim(str_replace(home_url(), '', get_category_link($category_id)), '/');
|
757 |
+
add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
|
758 |
+
add_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );
|
759 |
return $originalPermalink;
|
760 |
}
|
761 |
|
826 |
|
827 |
if (function_exists("add_action") && function_exists("add_filter")) {
|
828 |
add_action( 'template_redirect', 'custom_permalinks_redirect', 5 );
|
829 |
+
add_filter( 'post_link', 'custom_permalinks_post_link', 10, 3 );
|
830 |
+
add_filter( 'post_type_link', 'custom_permalinks_post_link', 10, 2 );
|
831 |
+
add_filter( 'page_link', 'custom_permalinks_page_link', 10, 2 );
|
832 |
+
add_filter( 'tag_link', 'custom_permalinks_term_link', 10, 2 );
|
833 |
+
add_filter( 'category_link', 'custom_permalinks_term_link', 10, 2 );
|
834 |
+
add_filter( 'request', 'custom_permalinks_request', 10, 1 );
|
835 |
+
add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
|
836 |
|
837 |
if (function_exists("get_bloginfo")) {
|
838 |
$v = explode('.', get_bloginfo('version'));
|
839 |
}
|
840 |
|
841 |
if ( $v[0] >= 2 ) {
|
842 |
+
add_filter( 'get_sample_permalink_html', 'custom_permalink_get_sample_permalink_html', 10, 4 );
|
843 |
} else {
|
844 |
add_action( 'edit_form_advanced', 'custom_permalinks_post_options' );
|
845 |
add_action( 'edit_page_form', 'custom_permalinks_page_options' );
|
854 |
add_action( 'edited_category', 'custom_permalinks_save_category' );
|
855 |
add_action( 'create_post_tag', 'custom_permalinks_save_tag' );
|
856 |
add_action( 'create_category', 'custom_permalinks_save_category' );
|
857 |
+
add_action( 'delete_post', 'custom_permalinks_delete_permalink', 10);
|
858 |
add_action( 'delete_post_tag', 'custom_permalinks_delete_term' );
|
859 |
add_action( 'delete_post_category', 'custom_permalinks_delete_term' );
|
860 |
add_action( 'admin_head', 'custom_permalinks_setup_admin_head' );
|
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.7
|
8 |
-
Stable tag: 0.9
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -34,6 +34,10 @@ within that category.
|
|
34 |
|
35 |
== Changelog ==
|
36 |
|
|
|
|
|
|
|
|
|
37 |
= 0.9 =
|
38 |
|
39 |
* Resolved the conflict with PolyLang Plugin
|
5 |
Tags: permalink, url, link, address, custom, redirect, custom post type
|
6 |
Requires at least: 2.6
|
7 |
Tested up to: 4.7
|
8 |
+
Stable tag: 0.9.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
34 |
|
35 |
== Changelog ==
|
36 |
|
37 |
+
= 0.9.1 =
|
38 |
+
|
39 |
+
* Fixed issues of Filters and Actions (Replaces 'edit_files' with 10)
|
40 |
+
|
41 |
= 0.9 =
|
42 |
|
43 |
* Resolved the conflict with PolyLang Plugin
|