0

I've been struggling for a while already and all of my attempts failed so I have no other choice but to ask for help here...

a) I've made a custom post type page_blox whose capability_type => 'page' and rewrite => array( 'slug' => 'blox' )

b) All of page_blox pages can be selected on Reading Settings screen (Admin) as 'Front page displays' > Static page

So far so good. However...

The problem:

Front-end home page URL doesn't read my_domain.com any more but also appends post_type and page slug so it looks like my_domain.com?page_blox=my-page-slug

The Question:

I believe it has something to do with WP's rewrite rules so how do I remove that appendix (?page_blox=my-page-slug) from home page URL?

My initial code did not score any results. Is there anybody willing to tell what's wrong with it?

function k_rewrite_rules( $wp_rewrite ) {
    $frontPost = get_post( get_option( 'page_on_front' ) );
    $wp_rewrite->rules = array( '^$' => $wp_rewrite->index . '?' . $frontPost->post_type . '=' . $frontPost->post_name ) + $wp_rewrite->rules;
}
add_action( 'generate_rewrite_rules', 'k_rewrite_rules' );
  • I am not English native speaker... But I thougth I know language quite well. But I have no idea what you tring to do. Can you step by step say what you achive to do with your homepage and what you basiclly did... – Butuzov Oct 22 '13 at 17:48
  • Did you re-save your Permalink settings to flush the rewrite rules? – Pat J Oct 22 '13 at 18:14
  • Yeap, permalinks resaved whenever changes are made. And when I var_dump( $wp_rewrite ) new rule is not there. – Dameer Oct 23 '13 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.