I have 5 custom fields in my wordpress instance that are boolean true/false values.
property_type_investment, property_type_office, property_type_rental, property_type_industrial, property_type_land
Is it possible to create a permalink for this custom post type that will check each of those meta value’s are true – and if so append a value to the url hyphenated?
example: if property_type_investment, property_type_office, and property_type_land are true. I would like the permalink to be…
/listings/investment-office-land/post-title/
Here is my register post type.
register_post_type( 'properties',
array(
'labels' => array(
'name' => 'Properties',
'singular_name' => 'Property',
'add_new' => 'Add New',
'add_new_item' => 'Add New Property',
'edit' => 'Edit',
'edit_item' => 'Edit Property',
'new_item' => 'New Property',
'view' => 'View',
'view_item' => 'View Property',
'search_items' => 'Search Properties',
'not_found' => 'No Property found',
'not_found_in_trash' => 'No Properties found in Trash',
'parent' => 'Parent Property'
),
'public' => true,
'rewrite' => array('slug'=>'listings'),
'menu_position' => 15,
'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'custom-fields' ),
'taxonomies' => array( '' ),
'has_archive' => true
)
);
you can rewrite the rule.
Don’t forget to flush the rewrite rule after register_post_type.
You can test using by a simple way using by
/%category%/%postname%/
in your admin panel->settings->permalink-> custom structure.