Instead of creating a new tag, I would suggest just writing code to create the slug on a per-post basis using ACF’s save_post function.
//Update Cars slug field:
function wpse_post_slug_updater( $post_id ) {
if( get_post_type() == 'cars') {
$my_post = array();
$my_post['ID'] = $post_id;
$my_post['post_title'] = esc_html(get_the_title($post_id));
$my_new_slug = get_field('brand') . ' ' . get_field('license_plate');
if(!empty($my_new_slug)){
$my_post['post_name'] = sanitize_title($my_new_slug);
wp_update_post( $my_post );
}
}
}
// run after ACF saves the $_POST['fields'] data
add_action('acf/save_post', 'wpse_post_slug_updater', 20);
Related Posts:
- post_type_link filter causes 404 on the CPT page it’s used on
- Maintaining WP_Query Relation Among CPT, Custom Taxonomy, Permalinks- CPT UI
- Remove POST_TYPE from custom post type permalink
- add category name to permalinks on product page /category-name/product-name
- How to set a CPT to have a page as a parent, then rewrite urls accordingly?
- How to change permalink to include custom post type
- Passing variables through permalink structure in custom post types
- Custom post type 404 error on “default” or “numeric” permalinks
- GravityForm: Populate Dropdown with custom post type [closed]
- How do I get the permalink structure to work like this?
- how to add extra meta box or textarea into custom post types
- Different permalink for CPT and regular Posts/Pages but why?
- Custom fields in Permalinks?
- How do I fix permalinks for custom post types that has the same slug as a page?
- Custom post type, permalinks & pagination, going wrong
- How much control do we have over CPT rewrite slugs? Can I create a “root” page for my CPT with out the page path, and then have paths for other pages?
- Change URL of posts and also Custom Post Type
- Custom post type template and custom post page not working
- “add_post_type_support” with Custom Post Type & ACF
- Shortcode insertion in tab
- Permalinks not working for custom taxonomy on custom post type
- remove permalink “front part” for custom post type
- Can’t get order_by meta_value_num to work properly
- How to quickly reorder posts in the admin panel that will persist for the wp-api
- Permalink Structure CPT With Custom Taxonomy Fails
- Parent & Child Taxonomy slugs in custom post permalink
- Add CPT as subpage under custom page
- Custom Post Types and independent Categories – complex Taxonomy
- WooCommerce product search titles only
- check if post title in a custom post type exists in page
- Change Permalink Structure for Tag.php template
- Removing parent slug in hierachial custom post type
- Bizarre Permalinks Issue: 404 Errors Everywhere
- Easy way to change custom post type name for permalinks?
- Custom post type permalinks
- Use different taxonomies in different custom post types’ permalinks?
- How to hack YARPP plugin to find related posts for custom post type?
- custom permalinks based on taxonomies for custom post type
- Why does wordpress keep adding postname to my CPT’s permalink in the end?
- post_type_link not working in gutenberg
- Wrong generated page_name/slug on first publish of custom post type
- Remove post type slug of all post types from permalinks
- Custom template won’t load for a custom post type (custom permalinks used)
- Show listings from Impress Listing plugin in random order using taxonomy and terms
- Making a custom help center page
- Stop / prevent WordPress from updating permalinks of custom post type
- Update menu when saving settings
- Custom taxonomy in URL showing 404
- One-to-many post relationships that are displayed by category (using posts-to-posts plugin)
- Custom post type and permalink issue
- How do I correct an incorrect permalink?
- How can I update the permalink everywhere for a custom post type?
- Update permalinks when new category added to custom post type taxonomy
- custom post type not showing in menu
- Custom posts don’t work
- Add archive slug to default post post type
- Custom Post type and permalink settings
- How to retain $_POST data when submitting form to custom page
- Why get_posts() not returning only selected category posts from Custom Post Type?
- single-{cpt}.php ignored
- If post has custom field then display css-class
- Custom rewrite rule for hierarchical custom post type
- Adding a custom post type taxonomy template in plugin
- Replace text in post from cvs
- Insert and then update post_type by wp_update_post
- Tag Archive for Custom-Post-Type Posts yielding 404 when permalinks set to postname
- Custom Post Types. Are there any disadvantages/advantages in using a plugin to develop them?
- How can I make a custom post type sticky?
- Use menus with anchors
- Custom Post Type permalink shows wrong page: homepage/index.php
- How do i calculate the total of values of custom fields in custom post types?
- Get term name and term parent into custom post type permalink
- WordPress add_permastruct unwanted matches
- Rewrite rules for custom posts types
- Permalink structure by Post Meta value
- Does WordPress consider a post name unique if that same post name is in multiple Post Types?
- Why doesn’t a custom post type permalink ever hit index.php
- How to hook custom taxonomies to custom post types and make the permalinks work?
- custom post type parsed as attachment
- Append varible to url or set session
- 404 Issue w/ Custom Post Type – using Meta for Permalink rewrite
- WordPress Custom Post Type Repeated 404 Errors
- Child post with numeric only slug keeps redirecting to parent
- How to change custom post type permalink structure
- How to make a proper custom post type link
- Custom post type url with category
- Help with Elementor Pagination CPT archive 404 problem
- Adding custom post category slug in permalink causes 404 error for pages and posts
- How can I use get_post_meta with add_rewrite_rule to build custom permalinks?
- Allow post/page hierarchy across different post types?
- Permalink for a custom post type isn’t working and I don’t know why
- Can’t get custom rewrite tag, query var, permastruct (permalink structure), and rewrite rule to work properly together
- Add custom post type settings to wordress default posts
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- WordPress Custom Post Type Permalinks dynamic term slugs
- ‘No Results Found’ on single post for custom post type
- 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?
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item