get_object_subtype_{$object_type}
Filter HookDescription
Filters the object subtype identifier for a non-standard object type. The dynamic portion of the hook name, `$object_type`, refers to the meta object type (post, comment, term, user, or any other type with an associated meta table). Possible hook names include: - `get_object_subtype_post` - `get_object_subtype_comment` - `get_object_subtype_term` - `get_object_subtype_user`Hook Information
File Location |
wp-includes/meta.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1834 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$object_subtype
|
Empty string to override. |
int
|
$object_id
|
ID of the object to get the subtype for. |
Usage Examples
Basic Usage
<?php
// Hook into get_object_subtype_{$object_type}
add_filter('get_object_subtype_{$object_type}', 'my_custom_filter', 10, 2);
function my_custom_filter($object_subtype, $object_id) {
// Your custom filtering logic here
return $object_subtype;
}
Source Code Context
wp-includes/meta.php:1834
- How this hook is used in WordPress core
<?php
1829 * @since 4.9.8
1830 *
1831 * @param string $object_subtype Empty string to override.
1832 * @param int $object_id ID of the object to get the subtype for.
1833 */
1834 return apply_filters( "get_object_subtype_{$object_type}", $object_subtype, $object_id );
1835 }
PHP Documentation
<?php
/**
* Filters the object subtype identifier for a non-standard object type.
*
* The dynamic portion of the hook name, `$object_type`, refers to the meta object type
* (post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
* - `get_object_subtype_post`
* - `get_object_subtype_comment`
* - `get_object_subtype_term`
* - `get_object_subtype_user`
*
* @since 4.9.8
*
* @param string $object_subtype Empty string to override.
* @param int $object_id ID of the object to get the subtype for.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/meta.php
Related Hooks
Related hooks will be displayed here in future updates.