Make WordPress Core

Ticket #30292: 30292.diff

File 30292.diff, 1.0 KB (added by MikeSchinkel, 10 years ago)

Adds a 'do_get_post' filter to get_post()

  • www/wp-includes/post.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    384384 * @return WP_Post|null WP_Post on success or null on failure
    385385 */
    386386function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) {
     387
     388        /**
     389         * Filter whether to process the post or just return the value.
     390         *
     391         * @since 4.x  @TODO Set version
     392         *
     393         * @param bool|object $bool     Whether or not to further process the post.
     394         * @param int|object  $this     Current WordPress environment instance.
     395         * @param string      $output   Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N.
     396         * @param string      $filter   Optional, default is raw.
     397         */
     398        if ( $_post = apply_filters( 'do_get_post', false, $post, $output, $filter ) ) {
     399                return $_post;
     400        }
     401
    387402        if ( empty( $post ) && isset( $GLOBALS['post'] ) )
    388403                $post = $GLOBALS['post'];
    389404