You appear to be a bot. Output may be restricted
Description
Determines post type from hook- Quite a few hook names are constructed with the $post_type variable
- This function performs a simple extraction of the $post_type
- It should only be called when the current hook name is believed to be $prefix . $post_type . $suffix
Usage
$string|null = bw_determine_post_type_from_hook( $hook, $prefix, $suffix );
Parameters
- $hook
- ( string ) required – the current hook
- $prefix
- ( mixed ) optional default: manage_ –
- $suffix
- ( mixed ) optional default: _posts_custom_column –
Returns
string|null the post type determined from the hookSource
File name: oik/libs/bw_fields.phpLines:
1 to 11 of 11
function bw_determine_post_type_from_hook( $hook, $prefix="manage_", $suffix="_posts_custom_column" ) { $post_type = null; if ( 0 === strpos( $hook, $prefix ) ) { $filter = substr( $hook, strlen( $prefix ) ); $suffix_start = strpos( $filter, $suffix ); if ( $suffix_start ) { $post_type = substr( $filter, 0, $suffix_start ); } } return $post_type; }View on GitHub View on Trac