Support

Account

Home Forums General Issues Custom Post Type Relationship Archive Page Reply To: Custom Post Type Relationship Archive Page

  • /**
     * URL Rewrite
     */
    add_action( 'generate_rewrite_rules', 'custom_rewrite_rules' );
    function custom_rewrite_rules()
    {
    	// get global rules
    	global $wp_rewrite; 
    
    	// add custom rules
    	$new_rules = array(
    		"artists/([^/]+)/works/?" => "index.php?post_type=artists&post_name=" . $wp_rewrite->preg_index(1)
    	);
    
    	// put custom rules into global rules
    	// or use array_push() ... 
    	$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
    }
    // go to settings -> permalinks to flush your rules

    Check out generate_rewrite_rules here … btw its not an issue from ACF!