Filter post_type_link
instead. This is reserved for custom post types, and you get the post
object, so you don’t need a global variable for this.
is_admin() or add_filter( 'post_type_link', 'career_position_url', 10, 2 );
function career_position_url( $url, $post )
{
global $career_mb;
if ( 'career' !== $post->post_type )
return $url;
$career = $career_mb->the_meta();
return add_query_arg( 'position', $career['career_position'], $url );
}
Related Posts:
- Add extra parameters after permalink?
- Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?
- How to change permalink structure for custom post type and it’s taxonomies?
- How to prefix post permalinks with /blog/ – without affecting custom post types?
- How to remove slug from hierarchical custom types in 3.5.2
- Remove slug in taxonomy url
- Disable permalink on custom post type
- Custom post type permalink is doesn’t show in admin
- 404 on child page when parent page slug is identical to custom post type
- custom post type and custom taxonomy permalink
- Is there a way to use regular categories with custom post types?
- rewrite get parameter with custom post type
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- Permalinks using event date (year & month) instead of publication date
- Including two taxonomies in a permalink structure
- WP Rewrite Rules – Custom post type & taxonomy
- Remove base slug in CPT & CT, use CT in permalink
- Permalink Structure problem with cpt and custom taxonomy
- Clean URL permalink for custom post type
- Change permalink structure for custom post type
- Writing Custom Rewrite Rules that Incorporate Category for Custom Post Types?
- Custom post type permalinks giving 404s
- Custom Taxonomies: Multiple Hierarchical Permailnks For A Single Post + Prev/Next Links
- Add the .html extension to custom post types
- Can’t edit Custom Post Type slug/permalink
- What is better: Custom Fields vs Custom Taxonomies with Terms for perfomance, scalability and better user experience
- Custom Permalink for Taxonimie and Custom Post Type
- Extend the wp_get_archives output with ‘?post_type=foo’?
- Custom Post Type with two hierarchical Custom Taxonomies: strategy to generate best permalink structure
- Function to get permalink of custom post type archives?
- How do I prefix blog post urls as mysite.com/blog/%postname%/ but allow authors to still be located at mysite.com/authors/%nicename%?
- Automaticly add slug to posts
- Different permalink for CPT and regular Posts/Pages but why?
- Custom fields in Permalinks?
- Custom post type, permalinks & pagination, going wrong
- Custom post type template and custom post page not working
- Permalink Structure CPT With Custom Taxonomy Fails
- Bizarre Permalinks Issue: 404 Errors Everywhere
- Custom post type permalinks
- Use different taxonomies in different custom post types’ permalinks?
- Making a custom help center page
- How to hook custom taxonomies to custom post types and make the permalinks work?
- WordPress Custom Post Type Repeated 404 Errors
- Child post with numeric only slug keeps redirecting to parent
- Can’t get custom rewrite tag, query var, permastruct (permalink structure), and rewrite rule to work properly together
- How to have the same url structure for both a CPT and a Taxonomy?
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- WordPress custom post type permalink rewrite shows page not found
- Removing custom post type slug from URL
- Customize Custom Post Type URL
- Remove CPT name from permalink but add %category% instead
- How to have this permalink structure: post_type/postname/custom_inner_page
- Additional section in custom post type permalink
- Custom post type permalink returns 404
- Use the same date-based permalink structure for all post types
- “Post name” permalink returns home page for custom posts
- How to make permalink structure %category%/%postname%/ work for custom post type?
- Rewrite rule for Custom post type Monthly and Yearly archive
- menu link to custom post_type?
- Custom permalink with child taxonomy terms
- How do you create %post_type%/%postname%/ permalink structure?
- Problems with 404, .htaccess, permalinks and WordPress custom posts locally on Snow Leopard
- How to query 2 custom post types that need to share a slug?
- Can variables be used to rewrite a Custom Post Type permalink? [duplicate]
- Set parent for custom post type archive rewrite url
- How to rewrite the beginning and end of the permalink structure in a custom post type?
- How to get all posts related to particular category name on button click?
- WordPress custom permalink and archive link for custom post type
- Custom Post Type Archive template not being called
- How to setup a permalink structure for a custom post type
- How to setup different permlalinks for posts and pages?
- Add unique ID number to end of permalink
- Custom Post Type Child Won’t Come Through With Pretty Permalinks
- Adding /blog in front of single posts (only)
- Disable permalinks, but allow RSS feeds
- Set priority to permalinks
- How to keep WP from creating a “single-post” page and let the user input the link of the post in the dashboard?
- Edit the default ‘post’ custom post type arguments
- add all blog posts to folder
- Changing CPT permalink
- CPT relations use in permalinks under single post type
- How can I get custom post types to recognize pretty permalink variables?
- Missing permalink for custom post type
- Custom post type and taxonomy same slug
- How to structure a website with custom post types and custom taxonomies?
- WordPress page not showing up – replaced with last 10 posts?
- Post Custom & Taxonomy 404 error
- Custom Post Type Taxonomy – Permalinks generating, but posts not found
- Custom taxonomy in custom post type archive with pagination
- Permalink clashing with Custom Post Type rewrite rule
- Issue with permalinks for custom post type
- Permalink Trouble with Custom Post Type
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- Linking from a list of custom post type items to a single – get_post_permalink not working correctly
- Custom post types not using archive structure
- Dynamically change Custom Post Type Template OR Change Permalink?
- Single and Archive Pages with Custom Post Type
- Custom post type and category permalinks
- Wp-theme Development
- Permalinks for Custom Post Types and Taxonomies