Version Description
- Hotfix for Posts & Pages permastructures
Download this release
Release Info
Developer | mbis |
Plugin | Permalink Manager Lite |
Version | 0.3.1 |
Comparing to | |
See all releases |
Code changes from version 0.3 to 0.3.1
- README.txt +9 -14
- permalink-manager.php +29 -11
README.txt
CHANGED
@@ -3,17 +3,17 @@ Contributors: mbis
|
|
3 |
Tags: urls, permalinks, slugs
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.5
|
6 |
-
Stable tag: 0.3
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
-
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
It is a really simple plugin that helps managing the permalinks that are used for all your Posts, Pages and other Custom Post Types. To improve the experience of the manager, you can filter the table and display only selected `post type`s or posts/pages/custom post type items with particular `post status`es.
|
15 |
|
16 |
-
There are
|
17 |
|
18 |
1. You can manually adjust the slugs of selected posts/pages/custom post type items.
|
19 |
2. You can replace particular (sub)string that is a part of slug with another (sub)string.
|
@@ -22,7 +22,7 @@ There are four main functionalities of this plugin:
|
|
22 |
|
23 |
= Example =
|
24 |
|
25 |
-
If you want to quickly replace a part of slug (eg. `krakow` with another word `gdansk`)
|
26 |
|
27 |
`http://example.com/hotels-in-krakow
|
28 |
http://example.com/restaurants-in-krakow
|
@@ -33,7 +33,7 @@ http://example.com/poland/cities/stalowa-wola
|
|
33 |
http://example.com/poland/cities/warszawa
|
34 |
http://example.com/poland/cities/poznan`
|
35 |
|
36 |
-
|
37 |
|
38 |
`http://example.com/hotels-in-gdansk
|
39 |
http://example.com/restaurants-in-gdansk
|
@@ -70,10 +70,13 @@ After the plugin is installed you can access its dashboard from this page: `Tool
|
|
70 |
1. Main dashboard.
|
71 |
2. Find and replace section.
|
72 |
3. Regenerate section.
|
73 |
-
4.
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
77 |
= 0.3 =
|
78 |
* Now all permalink parts can be edited - new "Permalink Base Editor" section added.
|
79 |
* Code optimization.
|
@@ -84,11 +87,3 @@ After the plugin is installed you can access its dashboard from this page: `Tool
|
|
84 |
|
85 |
= 0.1 =
|
86 |
* A first initial version.
|
87 |
-
|
88 |
-
== Upgrade Notice ==
|
89 |
-
|
90 |
-
= 0.1 =
|
91 |
-
Few bugs & strict standard errors are fixed.
|
92 |
-
|
93 |
-
= 0.1 =
|
94 |
-
A first initial version.
|
3 |
Tags: urls, permalinks, slugs
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.5
|
6 |
+
Stable tag: 0.3.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
+
Permalink Manager allows you to control and reset the permalinks (slugs) in all your post types.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
It is a really simple plugin that helps managing the permalinks that are used for all your Posts, Pages and other Custom Post Types. To improve the experience of the manager, you can filter the table and display only selected `post type`s or posts/pages/custom post type items with particular `post status`es.
|
15 |
|
16 |
+
There are three main functionalities of this plugin:
|
17 |
|
18 |
1. You can manually adjust the slugs of selected posts/pages/custom post type items.
|
19 |
2. You can replace particular (sub)string that is a part of slug with another (sub)string.
|
22 |
|
23 |
= Example =
|
24 |
|
25 |
+
If you want to quickly replace a part of slug (eg. `krakow` with another word `gdansk`):
|
26 |
|
27 |
`http://example.com/hotels-in-krakow
|
28 |
http://example.com/restaurants-in-krakow
|
33 |
http://example.com/poland/cities/warszawa
|
34 |
http://example.com/poland/cities/poznan`
|
35 |
|
36 |
+
If you use the form from `Find and replace` section your URLs will be changed to:
|
37 |
|
38 |
`http://example.com/hotels-in-gdansk
|
39 |
http://example.com/restaurants-in-gdansk
|
70 |
1. Main dashboard.
|
71 |
2. Find and replace section.
|
72 |
3. Regenerate section.
|
73 |
+
4.
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 0.3.1 =
|
78 |
+
* Hotfix for Posts & Pages permastructures
|
79 |
+
|
80 |
= 0.3 =
|
81 |
* Now all permalink parts can be edited - new "Permalink Base Editor" section added.
|
82 |
* Code optimization.
|
87 |
|
88 |
= 0.1 =
|
89 |
* A first initial version.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
permalink-manager.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Permalink Manager
|
5 |
* Plugin URI: http://maciejbis.net/
|
6 |
* Description: A simple tool that allows to mass update of slugs that are used to build permalinks for Posts, Pages and Custom Post Types.
|
7 |
-
* Version: 0.3.
|
8 |
* Author: Maciej Bis
|
9 |
* Author URI: http://maciejbis.net/
|
10 |
* License: GPL-2.0+
|
@@ -20,7 +20,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
20 |
|
21 |
// Define the directories used to load plugin files.
|
22 |
define( 'PERMALINK_MANAGER_PLUGIN_NAME', 'permalink-manager' );
|
23 |
-
define( 'PERMALINK_MANAGER_VERSION', '0.3.
|
24 |
define( 'PERMALINK_MANAGER_DIR', untrailingslashit( dirname( __FILE__ ) ) );
|
25 |
define( 'PERMALINK_MANAGER_URL', untrailingslashit( plugins_url( '', __FILE__ ) ) );
|
26 |
define( 'PERMALINK_MANAGER_WEBSITE', 'http://maciejbis.net' );
|
@@ -41,7 +41,9 @@ class Permalink_Manager_Class {
|
|
41 |
add_action( 'admin_menu', array($this, 'add_menu_page') );
|
42 |
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugins_page_links') );
|
43 |
|
44 |
-
add_filter( '
|
|
|
|
|
45 |
add_filter( '_get_page_link', array($this, 'custom_permalinks'), 999, 2);
|
46 |
add_filter( 'post_link', array($this, 'custom_permalinks'), 999, 2);
|
47 |
add_filter( 'post_type_link', array($this, 'custom_permalinks'), 999, 2);
|
@@ -582,22 +584,16 @@ class Permalink_Manager_Class {
|
|
582 |
/**
|
583 |
* Add rewrite rules
|
584 |
*/
|
585 |
-
function
|
586 |
|
587 |
global $wp_rewrite;
|
588 |
|
589 |
$new_rules = array();
|
590 |
$permastructures = $this->permalink_manager_options['base-editor'];
|
591 |
|
592 |
-
//
|
593 |
-
$page_p = $permastructures['page'];
|
594 |
-
$post_p = $permastructures['post'];
|
595 |
unset($permastructures['post'], $permastructures['page']);
|
596 |
|
597 |
-
$permastructures['page'] = $page_p;
|
598 |
-
$permastructures['post'] = $post_p;
|
599 |
-
$permastructures = array_reverse($permastructures);
|
600 |
-
|
601 |
foreach($permastructures as $post_type => $permastruct) {
|
602 |
// Ignore empty permastructures (do not add them)
|
603 |
if(empty($permastruct)) continue;
|
@@ -608,6 +604,28 @@ class Permalink_Manager_Class {
|
|
608 |
return $rules;
|
609 |
}
|
610 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
/**
|
612 |
* Flush rewrite rules
|
613 |
*/
|
4 |
* Plugin Name: Permalink Manager
|
5 |
* Plugin URI: http://maciejbis.net/
|
6 |
* Description: A simple tool that allows to mass update of slugs that are used to build permalinks for Posts, Pages and Custom Post Types.
|
7 |
+
* Version: 0.3.1
|
8 |
* Author: Maciej Bis
|
9 |
* Author URI: http://maciejbis.net/
|
10 |
* License: GPL-2.0+
|
20 |
|
21 |
// Define the directories used to load plugin files.
|
22 |
define( 'PERMALINK_MANAGER_PLUGIN_NAME', 'permalink-manager' );
|
23 |
+
define( 'PERMALINK_MANAGER_VERSION', '0.3.1' );
|
24 |
define( 'PERMALINK_MANAGER_DIR', untrailingslashit( dirname( __FILE__ ) ) );
|
25 |
define( 'PERMALINK_MANAGER_URL', untrailingslashit( plugins_url( '', __FILE__ ) ) );
|
26 |
define( 'PERMALINK_MANAGER_WEBSITE', 'http://maciejbis.net' );
|
41 |
add_action( 'admin_menu', array($this, 'add_menu_page') );
|
42 |
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugins_page_links') );
|
43 |
|
44 |
+
add_filter( 'page_rewrite_rules', array($this, 'custom_page_rewrite_rules'), 999, 1);
|
45 |
+
add_filter( 'post_rewrite_rules', array($this, 'custom_post_rewrite_rules'), 999, 1);
|
46 |
+
add_filter( 'rewrite_rules_array', array($this, 'custom_cpt_rewrite_rules'), 999, 1);
|
47 |
add_filter( '_get_page_link', array($this, 'custom_permalinks'), 999, 2);
|
48 |
add_filter( 'post_link', array($this, 'custom_permalinks'), 999, 2);
|
49 |
add_filter( 'post_type_link', array($this, 'custom_permalinks'), 999, 2);
|
584 |
/**
|
585 |
* Add rewrite rules
|
586 |
*/
|
587 |
+
function custom_cpt_rewrite_rules($rules) {
|
588 |
|
589 |
global $wp_rewrite;
|
590 |
|
591 |
$new_rules = array();
|
592 |
$permastructures = $this->permalink_manager_options['base-editor'];
|
593 |
|
594 |
+
// Rewrite rules for Posts & Pages are defined in different filters
|
|
|
|
|
595 |
unset($permastructures['post'], $permastructures['page']);
|
596 |
|
|
|
|
|
|
|
|
|
597 |
foreach($permastructures as $post_type => $permastruct) {
|
598 |
// Ignore empty permastructures (do not add them)
|
599 |
if(empty($permastruct)) continue;
|
604 |
return $rules;
|
605 |
}
|
606 |
|
607 |
+
/**
|
608 |
+
* Post Rewrite Rules
|
609 |
+
*/
|
610 |
+
function custom_post_rewrite_rules($rules) {
|
611 |
+
global $wp_rewrite;
|
612 |
+
if(isset($this->permalink_manager_options['base-editor']['post'])) {
|
613 |
+
$rules = $wp_rewrite->generate_rewrite_rules($wp_rewrite->root . $this->permalink_manager_options['base-editor']['post'], EP_PERMALINK);
|
614 |
+
}
|
615 |
+
return $rules;
|
616 |
+
}
|
617 |
+
|
618 |
+
/**
|
619 |
+
* Page Rewrite Rules
|
620 |
+
*/
|
621 |
+
function custom_page_rewrite_rules($rules) {
|
622 |
+
global $wp_rewrite;
|
623 |
+
if(isset($this->permalink_manager_options['base-editor']['page'])) {
|
624 |
+
$rules = $wp_rewrite->generate_rewrite_rules($wp_rewrite->root . $this->permalink_manager_options['base-editor']['page'], EP_PERMALINK);
|
625 |
+
}
|
626 |
+
return $rules;
|
627 |
+
}
|
628 |
+
|
629 |
/**
|
630 |
* Flush rewrite rules
|
631 |
*/
|