WordPress apply_filters_ref_array() Function Kodu

WordPress apply_filters_ref_array() Function Kodu

Bir dizideki argümanları belirterek, belirli bir filtre kancasına bağlı fonksiyonları yürütün.

apply_filters(): Bu işlev aynıdır, ancak bağımlı olan işlevlere iletilen argümanlar $tagbir dizi kullanılarak sağlanır.

function apply_filters_ref_array( $tag, $args ) {
    global $wp_filter, $wp_current_filter;
 
    // Do 'all' actions first
    if ( isset( $wp_filter['all'] ) ) {
        $wp_current_filter[] = $tag;
        $all_args            = func_get_args();
        _wp_call_all_hook( $all_args );
    }
 
    if ( ! isset( $wp_filter[ $tag ] ) ) {
        if ( isset( $wp_filter['all'] ) ) {
            array_pop( $wp_current_filter );
        }
        return $args[0];
    }
 
    if ( ! isset( $wp_filter['all'] ) ) {
        $wp_current_filter[] = $tag;
    }
 
    $filtered = $wp_filter[ $tag ]->apply_filters( $args[0], $args );
 
    array_pop( $wp_current_filter );
 
    return $filtered;
}

Benzer İçerikler

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.