Support

Account

Home Forums Backend Issues (wp-admin) Make a function copy with modifications

Unread

Make a function copy with modifications

  • Hello

    I like this function of ACF:

    function get_post_types( $post_types, $exclude = array(), $include = array() )
    	{
    		// get all custom post types
    		$post_types = array_merge($post_types, get_post_types());
    		
    		
    		// core include / exclude
    		$acf_includes = array_merge( array(), $include );
    		$acf_excludes = array_merge( array( 'acf', 'revision', 'nav_menu_item' ), $exclude );
    	 
    		
    		// include
    		foreach( $acf_includes as $p )
    		{					
    			if( post_type_exists($p) )
    			{							
    				$post_types[ $p ] = $p;
    			}
    		}
    		
    		
    		// exclude
    		foreach( $acf_excludes as $p )
    		{
    			unset( $post_types[ $p ] );
    		}
    		
    		
    		return $post_types;
    		
    	}

    Sadly I need only a specific taxonomies insted of this. How can I modify this to filter every product_cat category and not post_types?

Viewing 1 post (of 1 total)

The topic ‘Make a function copy with modifications’ is closed to new replies.