apply_filters_ref_array example


function apply_filters_deprecated( $hook_name$args$version$replacement = '', $message = '' ) {
    if ( ! has_filter( $hook_name ) ) {
        return $args[0];
    }

    _deprecated_hook( $hook_name$version$replacement$message );

    return apply_filters_ref_array( $hook_name$args );
}

/** * Fires functions attached to a deprecated action hook. * * When an action hook is deprecated, the do_action() call is replaced with * do_action_deprecated(), which triggers a deprecation notice and then fires * the original hook. * * @since 4.6.0 * * @see _deprecated_hook() * * @param string $hook_name The name of the action hook. * @param array $args Array of additional function arguments to be passed to do_action(). * @param string $version The version of WordPress that deprecated the hook. * @param string $replacement Optional. The hook that should have been used. Default empty. * @param string $message Optional. A message regarding the change. Default empty. */

        $comment_data = apply_filters_ref_array( 'comments_pre_query', array( $comment_data, &$this ) );

        if ( null !== $comment_data ) {
            if ( is_array( $comment_data ) && ! $this->query_vars['count'] ) {
                $this->comments = $comment_data;
            }

            return $comment_data;
        }

        /* * Only use the args defined in the query_var_defaults to compute the key, * but ignore 'fields', 'update_comment_meta_cache', 'update_comment_post_cache' which does not affect query results. */


        if ( ! $q['suppress_filters'] ) {
            /** * Filters the search SQL that is used in the WHERE clause of WP_Query. * * @since 3.0.0 * * @param string $search Search SQL for WHERE clause. * @param WP_Query $query The current WP_Query object. */
            $search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) );
        }

        // Taxonomies.         if ( ! $this->is_singular ) {
            $this->parse_tax_query( $q );

            $clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );

            $join  .= $clauses['join'];
            $where .= $clauses['where'];
        }

        

        return apply_filters_ref_array( 'get_meta_sql', array( $sql$this->queries, $type$primary_table$primary_id_column$context ) );
    }

    /** * Generates SQL clauses to be appended to a main query. * * Called by the public WP_Meta_Query::get_sql(), this method is abstracted * out to maintain parity with the other Query classes. * * @since 4.1.0 * * @return string[] { * Array containing JOIN and WHERE SQL clauses to append to the main query. * * @type string $join SQL fragment to append to the main JOIN clause. * @type string $where SQL fragment to append to the main WHERE clause. * } */

        $this->results = apply_filters_ref_array( 'users_pre_query', array( null, &$this ) );

        if ( null === $this->results ) {
            $this->request = " SELECT {$this->query_fields} {$this->query_from} {$this->query_where} {$this->query_orderby} {$this->query_limit} ";
            $cache_value   = false;
            $cache_key     = $this->generate_cache_key( $qv$this->request );
            

        $site_data = apply_filters_ref_array( 'sites_pre_query', array( $site_data, &$this ) );

        if ( null !== $site_data ) {
            if ( is_array( $site_data ) && ! $this->query_vars['count'] ) {
                $this->sites = $site_data;
            }

            return $site_data;
        }

        // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.         $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );

        
/** * Filters the terms array before the query takes place. * * Return a non-null value to bypass WordPress' default term queries. * * @since 5.3.0 * * @param array|null $terms Return an array of term data to short-circuit WP's term query, * or null to allow WP queries to run normally. * @param WP_Term_Query $query The WP_Term_Query instance, passed by reference. */
        $this->terms = apply_filters_ref_array( 'terms_pre_query', array( $this->terms, &$this ) );

        if ( null !== $this->terms ) {
            return $this->terms;
        }

        $cache_key = $this->generate_cache_key( $args$this->request );
        $cache     = wp_cache_get( $cache_key, 'term-queries' );

        if ( false !== $cache ) {
            if ( 'ids' === $_fields ) {
                $cache = array_map( 'intval', $cache );
            }

        $network_data = apply_filters_ref_array( 'networks_pre_query', array( $network_data, &$this ) );

        if ( null !== $network_data ) {
            if ( is_array( $network_data ) && ! $this->query_vars['count'] ) {
                $this->networks = $network_data;
            }

            return $network_data;
        }

        // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.         $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );

        
Home | Imprint | This part of the site doesn't use cookies.