bbp_get_global_post_field( string $field = 'ID', string $context = 'edit' )
Get the unfiltered value of a global $post’s key
Description Description
Used most frequently when editing a forum/topic/reply
Parameters Parameters
- $field
-
(Optional) Name of the key
Default value: 'ID'
- $context
-
(Optional) How to sanitize - raw|edit|db|display|attribute|js
Default value: 'edit'
Return Return
(string) Field value
Source Source
File: includes/common/functions.php
function bbp_get_global_post_field( $field = 'ID', $context = 'edit' ) { // Get the post, and maybe get a field from it $post = get_post(); $retval = isset( $post->{$field} ) ? sanitize_post_field( $field, $post->{$field}, $post->ID, $context ) : ''; // Filter & return return apply_filters( 'bbp_get_global_post_field', $retval, $post, $field, $context ); }
Changelog Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |