Created
February 21, 2016 16:04
-
-
Save ryozi-tn/176be5accaed02c34abe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simply fixed custom permalink | |
// dependencies: Custom Permalinks (plugin) | |
class Test{ | |
public function __construct() | |
{ | |
add_filter('get_sample_permalink_html', array( | |
$this,'get_sample_permalink_html' | |
), 999, 4); | |
} | |
// fixed permalink: 'original-post' | |
public function get_sample_permalink_html($html, $id, $new_title, $new_slug) | |
{ | |
// replace target: '?post_type=any&p=67' | |
// to: 'original-post' | |
$search_value = htmlspecialchars(sprintf('?post_type=%s&p=%d', 'original', $id)); | |
$replace_value = "original-post"; | |
$replaced_html = str_replace($search_value, $replace_value, $html); | |
return $replaced_html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment