---
title: Filtrar la lista de campos personalizados en esquemas
url: "https://www.seopress.org/es/soporte/hooks/filtrar-la-lista-de-campos-personalizados-en-esquemas/"
lang: es
updated: 2021-09-29
hook_name: seopress_get_custom_fields
required_version: 3.7.4
---

# Filtrar la lista de campos personalizados en esquemas

- **Hook name:** `seopress_get_custom_fields`
- **Required version:** 3.7.4

```php
function sp_get_custom_fields($cf_keys) {
	global $wpdb;
	
	//By default, we limit the post meta (custom fields) items to 250 max
	//This will increase the number to 400
	$limit = (int) apply_filters( 'postmeta_form_limit', 400 ); //default: 250
	
	//This SQL query will request all your custom fields except the ones added by SEOPress, it means, hidden post meta starting by an underscore will also appear from the list
	$cf_keys = $wpdb->get_col( "
			SELECT meta_key
			FROM $wpdb->postmeta
			GROUP BY meta_key
			HAVING meta_key NOT LIKE '\_seopress%%'
			ORDER BY meta_key
			LIMIT $limit" );

	return $cf_keys;
}
add_filter('seopress_get_custom_fields', 'sp_get_custom_fields');
```

Source: [https://gist.github.com/wp-seopress/61731f81eb756e6b16bf489ada4d09a9](https://gist.github.com/wp-seopress/61731f81eb756e6b16bf489ada4d09a9)



