Filter hook 'postmeta_form_limit'

in WP Core File wp-admin/includes/template.php at line 718

View Source

postmeta_form_limit

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

Hook Information

File Location wp-admin/includes/template.php View on GitHub
Hook Type Filter
Line Number 718

Hook Parameters

Type Name Description
int $limit Number of custom fields to retrieve. Default 30.

Usage Examples

Basic Usage
<?php
// Hook into postmeta_form_limit
add_filter('postmeta_form_limit', 'my_custom_filter', 10, 1);

function my_custom_filter($limit) {
    // Your custom filtering logic here
    return $limit;
}

Source Code Context

wp-admin/includes/template.php:718 - How this hook is used in WordPress core
<?php
 713  		 *
 714  		 * @since 2.1.0
 715  		 *
 716  		 * @param int $limit Number of custom fields to retrieve. Default 30.
 717  		 */
 718  		$limit = apply_filters( 'postmeta_form_limit', 30 );
 719  
 720  		$keys = $wpdb->get_col(
 721  			$wpdb->prepare(
 722  				"SELECT DISTINCT meta_key
 723  				FROM $wpdb->postmeta

PHP Documentation

<?php
/**
		 * Filters the number of custom fields to retrieve for the drop-down
		 * in the Custom Fields meta box.
		 *
		 * @since 2.1.0
		 *
		 * @param int $limit Number of custom fields to retrieve. Default 30.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-admin/includes/template.php
Related Hooks

Related hooks will be displayed here in future updates.