Exciting News! Flipper Code is now WePlugins! Same commitment to excellence, brand new identity.

How to use postmeta_form_limit filter in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
July 9, 2022
5 minutes read

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 );  
Sandeep Kumar Mishra

Sandeep Kumar Mishra

Sandeep Kumar Mishra writes about WordPress and Artificial Intelligence, offering tips and guides to help you master your website and stay updated with the latest tech trends.

Explore the latest in WordPress

Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.