How to add parent slug to CPT URL in WordPress?


function wpsc_gd_snippet_option_post_types( $value, $key, $default ) {
	$post_type 	= 'gd_place'; // Post type
	$top_level_item = 'resources'; // Top level item
	if ( ! empty( $value[ $post_type ] ) ) {
		$value[ $post_type ]['has_archive'] 	= $top_level_item . '/' . $value[ $post_type ]['rewrite']['slug'];
		$value[ $post_type ]['rewrite']['slug'] = $top_level_item . '/' . $value[ $post_type ]['rewrite']['slug'];
	}
	return $value;
}
add_filter( 'geodir_get_option_post_types', 'wpsc_gd_snippet_option_post_types', 21, 3 );

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This