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' ) {
|
| 5850 | 5850 | $last_changed = wp_cache_get_last_changed( 'posts' ); |
| 5851 | 5851 | |
| 5852 | 5852 | $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 | |
| 5854 | 5865 | $cached = wp_cache_get( $cache_key, 'post-queries' ); |
| 5855 | 5866 | if ( false !== $cached ) { |
| 5856 | 5867 | // Special case: '0' is a bad `$page_path`. |
| … |
… |
function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
|
| 5917 | 5928 | } |
| 5918 | 5929 | } |
| 5919 | 5930 | |
| | 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 | |
| 5920 | 5942 | // We cache misses as well as hits. |
| 5921 | 5943 | wp_cache_set( $cache_key, $foundid, 'post-queries' ); |
| 5922 | 5944 | |