-
-
Save mmarj/2cb1de91606dc2e5e81ec946bc915fe9 to your computer and use it in GitHub Desktop.
Freemius - weDocs Permalinks
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
| <?php | |
| /** | |
| * Customize docs permalinks parsing. | |
| * | |
| * @author Vova Feldman | |
| */ | |
| function freemius_docs_permastruct_rewrite() { | |
| if ( post_type_exists( 'docs' ) ) { | |
| // Modify root slug to "help" instead of docs. | |
| global $wp_post_types; | |
| /** | |
| * @var WP_Post_Type $docs | |
| */ | |
| $docs = $wp_post_types['docs']; | |
| $docs->remove_rewrite_rules(); | |
| $docs->rewrite['slug'] = 'help'; | |
| $docs->add_rewrite_rules(); | |
| add_post_type_support( 'docs', 'excerpt' ); | |
| add_post_type_support( 'docs', 'author' ); | |
| add_post_type_support( 'docs', 'page-attributes' ); | |
| add_post_type_support( 'docs', 'custom-fields' ); | |
| } | |
| } | |
| add_action( 'init', 'freemius_docs_permastruct_rewrite' ); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment