Custom Permalinks - Version 0.7.6

Version Description

  • Fixed permalink saving issue when not using ".../%postname%" or similar permalink structure
Download this release

Release Info

Developer michaeltyson
Plugin Icon Custom Permalinks
Version 0.7.6
Comparing to
See all releases

Code changes from version 0.7.4 to 0.7.6

Files changed (2) hide show
  1. custom-permalinks.php +10 -4
  2. readme.txt +9 -1
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.4
8
  Author: Michael Tyson
9
  Author URI: http://atastypixel.com/blog
10
  */
@@ -427,8 +427,14 @@ function custom_permalinks_save_post($id) {
427
  if ( !isset($_REQUEST['custom_permalinks_edit']) ) return;
428
 
429
  delete_post_meta( $id, 'custom_permalink' );
430
- if ( $_REQUEST['custom_permalink'] && $_REQUEST['custom_permalink'] != custom_permalinks_original_post_link($id) ) {
431
- if ( dirname($_REQUEST['custom_permalink']) == dirname(custom_permalinks_original_post_link($id)) ) {
 
 
 
 
 
 
432
  // Just slug changed
433
  $post = wp_get_single_post($id, ARRAY_A);
434
  $new_name = basename($_REQUEST['custom_permalink']);
@@ -718,7 +724,7 @@ function custom_permalinks_permalink_for_term($id) {
718
  * @since 0.1
719
  */
720
  function custom_permalinks_setup_admin() {
721
- add_management_page( 'Custom Permalinks', 'Custom Permalinks', 5, __FILE__, 'custom_permalinks_options_page' );
722
  if ( is_admin() )
723
  wp_enqueue_script('admin-forms');
724
  }
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.6
8
  Author: Michael Tyson
9
  Author URI: http://atastypixel.com/blog
10
  */
427
  if ( !isset($_REQUEST['custom_permalinks_edit']) ) return;
428
 
429
  delete_post_meta( $id, 'custom_permalink' );
430
+
431
+ $original_link = custom_permalinks_original_post_link($id);
432
+ $permalink_structure = get_option('permalink_structure');
433
+
434
+ if ( $_REQUEST['custom_permalink'] && $_REQUEST['custom_permalink'] != $original_link ) {
435
+ if ( substr($permalink_structure, strlen($permalink_structure)-strlen('/%postname%')) == '/%postname%' &&
436
+ dirname($_REQUEST['custom_permalink']) == dirname($original_link) &&
437
+ ($_REQUEST['custom_permalink']{strlen($_REQUEST['custom_permalink'])-1} == "/") == ($original_link{strlen($original_link)-1} == "/") ) {
438
  // Just slug changed
439
  $post = wp_get_single_post($id, ARRAY_A);
440
  $new_name = basename($_REQUEST['custom_permalink']);
724
  * @since 0.1
725
  */
726
  function custom_permalinks_setup_admin() {
727
+ add_management_page( 'Custom Permalinks', 'Custom Permalinks', 5, 'custom_permalinks', 'custom_permalinks_options_page' );
728
  if ( is_admin() )
729
  wp_enqueue_script('admin-forms');
730
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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: 3.2.1
7
- Stable tag: 0.7.4
8
 
9
  Set custom permalinks on a per-post, per-tag or per-category basis.
10
 
@@ -23,6 +23,14 @@ over your site structure.
23
 
24
  == Changelog ==
25
 
 
 
 
 
 
 
 
 
26
  = 0.7.4 =
27
 
28
  * Added support for changing post/page slug only
4
  Tags: permalink, url, link, address, custom, redirect
5
  Requires at least: 2.6
6
  Tested up to: 3.2.1
7
+ Stable tag: 0.7.6
8
 
9
  Set custom permalinks on a per-post, per-tag or per-category basis.
10
 
23
 
24
  == Changelog ==
25
 
26
+ = 0.7.6 =
27
+
28
+ * Fixed permalink saving issue when not using ".../%postname%" or similar permalink structure
29
+
30
+ = 0.7.5 =
31
+
32
+ * Fixed issue where changes to trailing "/" aren't saved
33
+
34
  = 0.7.4 =
35
 
36
  * Added support for changing post/page slug only