[ad_1]
I’ve hit a bit of a wall here. I need to take the value of a custom field (“id”) and insert it into the URL of a custom post type’s page (the CPT is “inventory-item”). The desired outcome is to have the URL structured as “domain.com/cars-for-sale/id/post-name.” The “Cars for Sale” component and “Post Name” components are already in place per how I set up the custom post type’s permalinks to work. I’m just really struggling with adding this ID segment.
Any thoughts?
[ad_2]
Where you get your custom field from? If you’re using acf it easy as this:
domain.com/cars-for-sale/<?php echo the_field( ‘id’ ); ?>/post-name