Changeset 3306 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php
- Timestamp:
- 06/06/2016 11:46:09 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php
r3302 r3306 900 900 901 901 /** 902 * Get the current post when inside a `map_meta_cap` callback 903 * 904 * Normally it's just the global $post, but sometimes you have to dig it out of $args (e.g., a bulk edit) 905 * 906 * @param array $args The $args that was passed to the `map_meta_cap` callback 907 * 908 * @return WP_Post|null 909 */ 910 public static function get_map_meta_cap_post( $args ) { 911 $post = null; 912 913 /* 914 * Use a reference to the global $post if it already exists, but don't create one otherwise 915 * 916 * i.e., Don't use `global $post` and then assign the result of `get_post()` to that. 917 * 918 * If $GLOBAL['post'] didn't already exist and then we created one, then that could have unintentional 919 * side-effects outside of this function. 920 */ 921 if ( isset( $GLOBALS['post'] ) ) { 922 $post = $GLOBALS['post']; 923 } elseif ( isset( $args[0] ) && is_int( $args[0] ) ) { 924 $post = get_post( $args[0] ); 925 } 926 927 return $post; 928 } 929 930 /** 902 931 * Insert an entry into a log for one of the custom post types 903 932 *
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)