WPIntell

Source evidence

Solution for permalink issue

ONTRApages · support · 2017-08-07T05:27:00+00:00

complaintsentiment
mediumseverity
0.92relevance
5replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

3 / 25 rows with source links

12.0% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

22 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
ultione unresolved
I’ve been looking at how to help with the permalink issue with this plugin. One way is for existing users to add this piece of code to your functions.php file function ontrapage_custom_post_type_mod( $args, $post_type ) { if ( $post_type == "ontrapage" ) { $args['rewrite'] = array( 'slug' => '/' ); } return $args; } add_filter( 'register_post_type_args', 'ontrapage_custom_post_type_mod', 10, 2 ); This will allow any type of permalink structures you have. For developers of this plugin, please update the way you register the ontrapage post type. Instead of 'rewrite' => array( 'slug' => 'o' ) change it to 'rewrite' => array( 'slug' => '/' ) This will make things so much simpler for what you are trying to achieve to make ontrapage custom post type behave like a wordpress page. Once this is done, the removeSlug() and interceptRequestTrickery() functions can be removed from the plugin. Found a bug in my original solution. Please use this code instead function 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. One 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. Sorry 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. I’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% Everyone is free to try this solution, but as with any custom coded solution, it is not supported by ONTRAPORT.

Comments

5 shown
ultione 2017-08-07T05:42:00+00:00

Found a bug in my original solution. Please use this code instead function 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.

ultione 2017-08-07T05:49:00+00:00

One 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.

ultione 2017-08-07T06:14:00+00:00

Sorry 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.

ultione 2017-08-07T12:28:00+00:00

I’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%

ontraportfrank 2017-08-07T14:02:00+00:00

Everyone is free to try this solution, but as with any custom coded solution, it is not supported by ONTRAPORT.