Created
January 26, 2023 18:01
-
-
Save abdulawal39/23ce77a28c6a05c73beac53aa4908ac0 to your computer and use it in GitHub Desktop.
Change the slug of pdf viewer for wordpress from pdfviewer to anything you prefer. Put the code below in your active theme's fuctions.php file
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
if( ! function_exists( 'themencode_change_pdfviewer_slug' ) ): | |
add_filter( 'register_post_type_args', 'themencode_change_pdfviewer_slug', 10, 2 ); | |
function themencode_change_pdfviewer_slug( $args, $post_type ) { | |
if ( 'pdfviewer' === $post_type ) { | |
$args['rewrite']['slug'] = 'pdfs'; // replace pdfs with your preferred slug | |
} | |
return $args; | |
} | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure to navigate to Settings > Permalinks Page once after adding this code for the change to be propagated completely