WP_REST_Pattern_Directory_Controller::get_transient_key() – Filter collection parameters for the block pattern directory controller.

You appear to be a bot. Output may be restricted

Description

Filter collection parameters for the block pattern directory controller.

Usage

WP_REST_Pattern_Directory_Controller::get_transient_key( $query_args );

Parameters

$query_args
( mixed ) required

Returns

void

Source

File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php
Lines:

1 to 17 of 17
  protected function get_transient_key( $query_args ) {

    if ( isset( $query_args['slug'] ) ) {
      // This is an additional precaution because the "sort" function expects an array.
      $query_args['slug'] = wp_parse_list( $query_args['slug'] );

      // Empty arrays should not affect the transient key.
      if ( empty( $query_args['slug'] ) ) {
        unset( $query_args['slug'] );
      } else {
        // Sort the array so that the transient key doesn't depend on the order of slugs.
        sort( $query_args['slug'] );
      }
    }

    return 'wp_remote_block_patterns_' . md5( serialize( $query_args ) );
  }
 

 View on GitHub View on Trac