Add the code before add_meta_box. I have updated the first post as well.
// TEMP-FIX FOR FAULTY PERMALINKS
global $post, $wp_query;
$wp_query->post = $post;
Related Posts:
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- Adding an extra parameter [string] to my posts’ permalink?
- Query Custom Posts – Add To Selection
- One Custom Post Type two different Templates
- How to retrieve custom post type permalink in another cpt?
- Custom post type – permalink
- Custom Taxonomy as checkbox or dropdown
- Custom Post Type Permalink / Rewrite not working immediately
- How to remove /blog/ prefix for custom post types in permalinks?
- WordPress Custom Post Type is Matching on Partial Slug
- echo value from ‘select’ field type into page template using cmb2?
- WP_List_Table Inside Metabox Not Working on Submit
- wp_generate_attachment_metadata gives me an empty array
- Custom permalinks
- Permalink for CPT with taxonomy
- Best way to arrange custom post types by Attributes -> Order metabox value?
- Custom Permalinks for Custom Post Types and Taxonomies
- Removing Edit Permalink/View “Custom Post Type” areas
- Unable to save custom taxonomy terms in a custom-built metabox
- Removing parent slug from URL on custom post type
- Maintaining WP_Query Relation Among CPT, Custom Taxonomy, Permalinks- CPT UI
- Custom post type category, taxonomy and URL rewrite problem
- Possible to add meta box to edit.php pages?
- Custom Post Type: How to display all of same taxonomy?
- How can I include meta box content when searching?
- Custom post type permalink missing /post_type/ front
- Remove POST_TYPE from custom post type permalink
- Custom post types and permalink
- Custom post types, taxonomies, and permalinks
- How can I display my custom metaboxes on a custom post template?
- Custom Post Type with metaboxes (no content) only?
- Permalinks not working for custom taxonomy on custom post type
- Custom Post Type permalink shows wrong page: homepage/index.php
- Get term name and term parent into custom post type permalink
- Rewrite rules for custom posts types
- Is it possible to create relational metabox values in a custom post?
- Changing custom type name hides the posts
- Custom post type as home page with custom url
- URL rewrite add author as base
- CPT’s with landing page instead of archive – Url Rewrite?
- Fixed values for same post translations
- Hierarchical permalinks for custom post type and taxonomy
- How to organize hierarchical structure in custom post type with taxonomy (like with categories)
- How can I move (or create another) publish button?
- Wrap meta boxes & data handling for specific post types in classes?
- Remove “show sharing buttons” metabox Jetpack from custom post type
- Remove permalink for custom post type
- Best way to specify “article type” in URL
- Custom Meta Box Causing Error: “Are you sure you want to do this? Please try again.”
- What do the numbers mean at the end of add_action(‘save_post’)…?
- A meta box (in a custom post type) with two different type of fields
- Unable to display selected post title in frontend from metabox wp_dropdown_pages()
- Custom Meta Box returns no HTML
- Custom post type permalink returns 404 when set to private
- Topic won’t save for a custom post type — how to debug?
- how to retain the ability to modify the post slug after applying a post_type_link filter?
- Removing numerous Meta boxes from numerous CPTs
- Save Metabox Custom Field Value
- Custom permalink structure for remote content pages
- WordPress Custom URLs
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- Empty meta-box returns publishdate if no value is set?
- Permalinks not working (404) for the ‘item’ post type
- Wp PageNavi only works with default permalinks on a custom post type?
- Custom category URL not displaying posts
- Change permalink for custom post type?
- Select Venue from dropdown list and reuse stored address information in meta_box
- Custom Meta Box with variable number of fields
- Use a different URL path / permalink for CPT
- Save Custom Post Value
- Duplicate slug/permalink issue while adding same post name
- Custom Metabox Info Not Saving
- $_POST from a Meta Box
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- Pretty Permalinks with CTP and Taxonomies / Hierarchical
- % encoded URL giving 404 error in WordPress
- Issue with Custom Post Types and Permalinks
- How can i remove post type archive URL?
- Custom post type URL structure with site.com/custom_taxonomy_slug/post_name
- Pretty permalink structure with multiple (AND OR) taxonomies
- 404 custom post type
- Custom post URLs
- wp_dropdown_pages doesn’t allow me to select more than one custom post type
- Delete custom post type metadata without deleting the post in admin area
- Metabox is not saving
- How can I add a “fake” parent into the permalink?
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Custom Post Type Archive Links Not Working
- Custom Post Type Categories Not Maintaining URL structure any more
- Add category slug as class attribute in a link array
- Get post id of permalink for a specific custom post type?
- URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php
- Add taxonomy to custom post type archive
- Custom Post Type – Rewrite slug [duplicate]
- Custom Post Type Permalinks with %category%
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- How to query custom post then display sections by meta value
- Custom post types permalinks not working
- Rewrite rules for using the same base slug for multiple content types
- Display div based on Group metabox selection [closed]