Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'post_type_link', '_custom_link' , 10, 2 );
- function _custom_link( $post_link, $id = 0 ) {
- $post = get_post($id);
- if ( is_wp_error($post) || 'company' != $post->post_type || empty($post->post_name) )
- return $post_link;
- return home_url(user_trailingslashit( "$post->post_name" ));
- }
- add_action('init', '_custom_rewrite_rule');
- function _custom_rewrite_rule() {
- add_rewrite_rule('(.*?)$', 'index.php?company=$matches[1]', 'top');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement