Make WordPress Core

Ticket #57622: 57622.3.diff

File 57622.3.diff, 1.5 KB (added by xipasduarte, 2 years ago)
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 993056ff2c..c874c39188 100644
    a b function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {  
    58505850        $last_changed = wp_cache_get_last_changed( 'posts' );
    58515851
    58525852        $hash      = md5( $page_path . serialize( $post_type ) );
    5853         $cache_key = "get_page_by_path:$hash:$last_changed";
     5853
     5854        /**
     5855         * Filters the cache key for the ID found for the given path.
     5856         *
     5857         * @since unreleased
     5858         *
     5859         * @param string       $cache_key Default cache key.
     5860         * @param string       $page_path Page path.
     5861         * @param string|array $post_type Post type or array of post types.
     5862         */
     5863        $cache_key = apply_filters( 'page_by_path_cache_key', "get_page_by_path:$hash:$last_changed", $page_path, $post_type );
     5864
    58545865        $cached    = wp_cache_get( $cache_key, 'post-queries' );
    58555866        if ( false !== $cached ) {
    58565867                // Special case: '0' is a bad `$page_path`.
    function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {  
    59175928                }
    59185929        }
    59195930
     5931        /**
     5932         * Filters the ID that was found for the (path, post type) pair.
     5933         *
     5934         * @since unreleased
     5935         *
     5936         * @param int          $foundid   ID found for the (path, post type) pair.
     5937         * @param string       $page_path Page path.
     5938         * @param string|array $post_type Post type or array of post types.
     5939         */
     5940        $foundid = apply_filters( 'page_by_path_id', $foundid, $page_path, $post_type );
     5941
    59205942        // We cache misses as well as hits.
    59215943        wp_cache_set( $cache_key, $foundid, 'post-queries' );
    59225944