Custom Permalinks - Version 0.9.2

Version Description

  • Fixed WPML Conflicts
Download this release

Release Info

Developer sasiddiqui
Plugin Icon Custom Permalinks
Version 0.9.2
Comparing to
See all releases

Code changes from version 0.9.1 to 0.9.2

Files changed (2) hide show
  1. custom-permalinks.php +9 -5
  2. readme.txt +6 -2
custom-permalinks.php CHANGED
@@ -5,7 +5,7 @@
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
@@ -29,8 +29,10 @@
29
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30
  */
31
 
 
32
  if ( ! defined( 'ABSPATH' ) ) {
33
- exit; // don't access directly
 
34
  }
35
 
36
  /**
@@ -47,7 +49,7 @@ if ( ! defined( 'ABSPATH' ) ) {
47
  function custom_permalinks_post_link($permalink, $post) {
48
  $custom_permalink = get_post_meta( $post->ID, 'custom_permalink', true );
49
  if ( $custom_permalink ) {
50
- return home_url()."/".$custom_permalink;
51
  }
52
 
53
  return $permalink;
@@ -62,7 +64,7 @@ function custom_permalinks_post_link($permalink, $post) {
62
  function custom_permalinks_page_link($permalink, $page) {
63
  $custom_permalink = get_post_meta( $page, 'custom_permalink', true );
64
  if ( $custom_permalink ) {
65
- return home_url()."/".$custom_permalink;
66
  }
67
 
68
  return $permalink;
@@ -81,7 +83,7 @@ function custom_permalinks_term_link($permalink, $term) {
81
  $custom_permalink = custom_permalinks_permalink_for_term($term);
82
 
83
  if ( $custom_permalink ) {
84
- return home_url()."/".$custom_permalink;
85
  }
86
 
87
  return $permalink;
@@ -280,8 +282,10 @@ function custom_permalinks_request($query) {
280
  function custom_permalinks_trailingslash($string, $type) {
281
  global $_CPRegisteredURL;
282
 
 
283
  $url = parse_url(get_bloginfo('url'));
284
  $request = ltrim(isset($url['path']) ? substr($string, strlen($url['path'])) : $string, '/');
 
285
 
286
  if ( !trim($request) ) return $string;
287
 
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.2
9
  * Author: Michael Tyson
10
  * Author URI: http://atastypixel.com/blog
11
  * Text Domain: custom-permalinks
29
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30
  */
31
 
32
+ // Make sure we don't expose any info if called directly
33
  if ( ! defined( 'ABSPATH' ) ) {
34
+ echo 'Hi there! I\'m just a plugin, not much I can do when called directly.';
35
+ exit;
36
  }
37
 
38
  /**
49
  function custom_permalinks_post_link($permalink, $post) {
50
  $custom_permalink = get_post_meta( $post->ID, 'custom_permalink', true );
51
  if ( $custom_permalink ) {
52
+ return apply_filters( 'wpml_permalink', home_url()."/".$custom_permalink );
53
  }
54
 
55
  return $permalink;
64
  function custom_permalinks_page_link($permalink, $page) {
65
  $custom_permalink = get_post_meta( $page, 'custom_permalink', true );
66
  if ( $custom_permalink ) {
67
+ return apply_filters( 'wpml_permalink', home_url()."/".$custom_permalink );
68
  }
69
 
70
  return $permalink;
83
  $custom_permalink = custom_permalinks_permalink_for_term($term);
84
 
85
  if ( $custom_permalink ) {
86
+ return apply_filters( 'wpml_permalink', home_url()."/".$custom_permalink );
87
  }
88
 
89
  return $permalink;
282
  function custom_permalinks_trailingslash($string, $type) {
283
  global $_CPRegisteredURL;
284
 
285
+ remove_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
286
  $url = parse_url(get_bloginfo('url'));
287
  $request = ltrim(isset($url['path']) ? substr($string, strlen($url['path'])) : $string, '/');
288
+ add_filter( 'user_trailingslashit', 'custom_permalinks_trailingslash', 10, 2 );
289
 
290
  if ( !trim($request) ) return $string;
291
 
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: sasiddiqui, michaeltyson
4
  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.1
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.1 =
38
 
39
  * Fixed issues of Filters and Actions (Replaces 'edit_files' with 10)
4
  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.8
8
+ Stable tag: 0.9.2
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.2 =
38
+
39
+ * Fixed WPML Conflicts
40
+
41
  = 0.9.1 =
42
 
43
  * Fixed issues of Filters and Actions (Replaces 'edit_files' with 10)