Created
December 9, 2020 12:33
-
-
Save smileBeda/d10e550864003654ebf9a3068f354bc2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
add_filter( 'post_link', 'add_custom_base_to_post_links', 10, 3 ); | |
function add_custom_base_to_post_links( $post_link, $post, $leavename ) { | |
if ( 'post' != $post->post_type || 'publish' != $post->post_status ) { | |
return $post_link; | |
} | |
$post_link = str_replace( '/' . $post->post_name . '/', '/your_custom_base/' . $post->post_name . '/', $post_link ); | |
return $post_link; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment