acf/get_post_types

The Advanced Custom Fields acf get post types hook.

Description

apply_filters( 'acf/get_post_types', (array) $array ); 

Parameters (1)

0. $array (array) => array()
The array.

Usage

To run the hook, copy the example below.
  1. $array = apply_filters( 'acf/get_post_types', $array ); 
  2.  
  3. if ( !empty( $array ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the acf/get_post_types callback 
  2. function filter_acf_get_post_types( $array ) { 
  3. // make filter magic happen here... 
  4. return $array
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'acf/get_post_types', 'filter_acf_get_post_types', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'acf/get_post_types', 'filter_acf_get_post_types', 10, 1 ); 

Defined (9)

The filter is defined in the following location(s).

/core/fields/relationship.php  
  1. $options['post_type'] = apply_filters('acf/get_post_types', array()); 
  1. $post_types = apply_filters( 'acf/get_post_types', array() ); 
  1. $choices = apply_filters('acf/get_post_types', $choices); 
  1. 'post_type' => apply_filters('acf/get_post_types', array()), 
/core/fields/post_object.php  
  1. $field['post_type'] = apply_filters('acf/get_post_types', array()); 
  1. $choices = apply_filters('acf/get_post_types', $choices); 
  1. 'post_type' => apply_filters('acf/get_post_types', array()), 
/core/fields/page_link.php  
  1. $choices = apply_filters('acf/get_post_types', $choices); 
/core/controllers/field_group.php  
  1. $choices = apply_filters('acf/get_post_types', array(), array('attachment'));