acf/get_post_id

Acf_filter_post_id().

Description

apply_filters( 'acf/get_post_id', (unknown) $post_id ); 

This is a deprecated function which is now run through a filter

Parameters (1)

0. $post_id (unknown)
The post id.

Usage

To run the hook, copy the example below.
  1. $post_id = apply_filters( 'acf/get_post_id', $post_id ); 
  2.  
  3. if ( !empty( $post_id ) ) { 
  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_id callback 
  2. function filter_acf_get_post_id( $post_id ) { 
  3. // make filter magic happen here... 
  4. return $post_id
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'acf/get_post_id', 'filter_acf_get_post_id', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'acf/get_post_id', 'filter_acf_get_post_id', 10, 1 ); 

Defined (7)

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

/core/api.php  
  1. return apply_filters('acf/get_post_id', $post_id ); 
  1. $post_id = apply_filters('acf/get_post_id', $post_id ); 
  1. $options['post_id'] = apply_filters('acf/get_post_id', $options['post_id'] ); 
  1. $post_id = apply_filters('acf/get_post_id', $post_id ); 
  1. $post_id = apply_filters('acf/get_post_id', $post_id ); 
  1. $post_id = apply_filters('acf/get_post_id', $post_id ); 
/acf.php  
  1. add_filter('acf/get_post_id', array($this, 'get_post_id'), 1, 1);