WordPress.org

Make WordPress Core

Ticket #37114: 37114.0.patch

File 37114.0.patch, 1.2 KB (added by bordoni, 4 years ago)

Patch v0

  • src/wp-includes/post-template.php

    diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php
    index 6ddc4b3..122f019 100644
    a b function post_class( $class = '', $post_id = null ) { 
    445445 * @return array Array of classes.
    446446 */
    447447function get_post_class( $class = '', $post_id = null ) {
     448        /**
     449         * Filters the get_post_class result before any Database requests are made.
     450         *
     451         * This allows one to short-circuit the default logic, perhaps by
     452         * replacing it with a routine that is more optimal for your setup.
     453         *
     454         * Passing a non-null value to the filter will effectively short-circuit retrieval,
     455         * returning the passed value instead.
     456         *
     457         * @since 4.6
     458         *
     459         * @param null|string $result  The UNSANITIZED (and potentially unsafe) Classes that should be used for this post. Default null.
     460         * @param string      $class   The UNSANITIZED (and potentially unsafe) Classes that were provided to the get_post_class initially.
     461         * @param int|WP_Post $post_id Optional. Post ID or post object.
     462         */
     463        $pre = apply_filters( 'pre_post_class', null, $class, $post_id );
     464
     465        if ( null !== $pre ) {
     466                return $pre;
     467        }
     468
    448469        $post = get_post( $post_id );
    449470
    450471        $classes = array();