I want to append the URL when viewing a single post.
For example when im on a post I want the url to be something like: example.com/mypage/mypage/single-post-article
The default url is example.com/single-post-article
I did not find something here on WPSE or the goooglz, but I have read about wp-rewrite
and tried add_post_type_support
to the post
but no luck!
add_post_type_support( 'post', array(
'rewrite' => array('slug' => '/bla/bla/')
));
Do I need to use wp_rewrite
?
Update
I did get this to work by run register_post_type
on the post_type “post” again. But is this the best way?
register_post_type( 'post', array(
'public' => true,
'_builtin' => false,
'_edit_link' => 'post.php?post=%d',
'capability_type' => 'post',
'map_meta_cap' => true,
'hierarchical' => false,
'rewrite' => array( 'slug' => '/mypage/mypage' ),
'query_var' => false,
'pages' => false,
'supports' => array(
'title',
'editor',
'author',
'thumbnail',
'excerpt',
'revisions
),
));
Go to your Settings > Permalinks page and set your permalinks to:
If you don’t want categories to append
/mypage/mypage
, you can change their permastruct:Did you try flushing your rewrite rules after you defined them?