ultione
Forum Replies Created
-
Forum: Plugins
In reply to: [ONTRApages] Solution for permalink issueI’ve managed to rework the solution for a possible workaround.
Add below code to functions.php. And flush your permalink settings (Go to Settings > Permalinks and press save changes to refresh)function ontrapage_custom_post_type_mod( $args, $post_type ) { if ( $post_type == "ontrapage" ) { $args['rewrite'] = array( 'slug' => 'o', 'with_front' => false ); //set url so that it does not show anything in front } return $args; } add_filter( 'register_post_type_args', 'ontrapage_custom_post_type_mod', 10, 2 ); function add_ontrapage_custom_rewrite() { add_rewrite_rule('([^/]+)(?:/([0-9]+))?/?$', 'index.php?ontrapage=$matches[1]&page=$matches[2]', 'bottom'); } add_action( 'init', 'add_ontrapage_custom_rewrite' );
This was tested on a permalink structure of /blog/%postname%
Forum: Plugins
In reply to: [ONTRApages] Solution for permalink issueSorry to get everyone’s hopes up.
The solution will fix the permalink issue for ontrapages but will stuff up normal wordpress pages.So please DELETE this solution. Thanks.
Forum: Plugins
In reply to: [ONTRApages] Solution for permalink issueOne thing to add, for users, once you have added the code to your functions.php Make sure that you flush your permalinks.
Go to Settings > Permalinks and press save changes to refresh.Forum: Plugins
In reply to: [ONTRApages] Solution for permalink issueFound a bug in my original solution.
Please use this code insteadfunction ontrapage_custom_post_type_mod( $args, $post_type ) { if ( $post_type == "ontrapage" ) { $args['rewrite'] = array( 'slug' => '/', 'with_front' => false ); } return $args; } add_filter( 'register_post_type_args', 'ontrapage_custom_post_type_mod', 10, 2 );
And for the plugin developer
'rewrite' => array( 'slug' => '/', 'with_front' => false )
Once the plugin is updated, the additional code to functions.php will not be required. If left alone, will not cause any issues either.