postmeta_form_limit filter

Filters the number of custom fields to retrieve for the drop-down in the Custom Fields meta box.

apply_filters( 'postmeta_form_limit', int $limit )

Description

This is filter hook , its filter the number of custom fields to retrieve for the drop-down in the Custom Fields meta box.
Its consists of one parameter, that is $limit Object.

Parameters

  • $limit : (int) Number of custom fields to retrieve. Default 30.

Live Example

To run the hook, copy the example below.

$int = apply_filters( 'postmeta_form_limit', $int ); 
                         
if ( !empty( $int ) ) { 
                         
   // everything has led up to this point... 
                         
} 
  
   

// define the postmeta_form_limit callback

function filter_postmeta_form_limit( $int ) { 
    // make filter magic happen here... 
    return $int; 
}; 
         
// add the filter 
add_filter( 'postmeta_form_limit', 'filter_postmeta_form_limit', 10, 1 ); 

To remove a hook callback, use the example below.

// remove the filter 
remove_filter( 'postmeta_form_limit', 'filter_postmeta_form_limit', 10, 1 );  
JOIN 100,000+ SUBSCRIBER's FAMILY

 Subscribe to our weekly newsletter below and never miss the latest updates in WordPress