rewrite - Wordpress - changing a custom post type archive link -
i had create custom post type, let's call 'trucks'. link archive of posts looks that: http://example.com/wpdirectory/?post_type=trucks want that: http://example.com/wpdirectory/trucks without '?post_type=' query. how can affect it?
try using add_rewrite_rule()
function functions.php file. try this:
add_action( 'init', 'rewriteposttype' ); function rewriteposttype(){ add_rewrite_rule('^wpdirectory/([^/]*)/?','index.php?post_type=$matches[1]','top'); add_rewrite_tag('%post_type%','([^&]+)'); }
otherwise can overwrite permastructures in settings -> permalinks
in wordpress , hard code in.
Comments
Post a Comment