current_filter example



    /** * Pre-filters captured option values before retrieving. * * @since 3.9.0 * * @param mixed $value Value to return instead of the option value. * @return mixed Filtered option value. */
    public function capture_filter_pre_get_option( $value ) {
        $option_name = preg_replace( '/^pre_option_/', '', current_filter() );

        if ( isset( $this->_captured_options[ $option_name ] ) ) {
            $value = $this->_captured_options[ $option_name ];

            /** This filter is documented in wp-includes/option.php */
            $value = apply_filters( 'option_' . $option_name$value$option_name );
        }

        return $value;
    }

    


        return preg_replace( '/^<script /i', '<script defer ', $tag );
    }

    public static function get_akismet_form_fields() {
        $fields = '';

        $prefix = 'ak_';

        // Contact Form 7 uses _wpcf7 as a prefix to know which fields to exclude from comment_content.         if ( 'wpcf7_form_elements' === current_filter() ) {
            $prefix = '_wpcf7_ak_';
        }

        $fields .= '<p style="display: none !important;">';
        $fields .= '<label>&#916;<textarea name="' . $prefix . 'hp_textarea" cols="45" rows="8" maxlength="100"></textarea></label>';

        if ( ! function_exists( 'amp_is_request' ) || ! amp_is_request() ) {
            // Keep track of how many ak_js fields are in this page so that we don't re-use             // the same ID.             static $field_count = 0;

            


    $updates               = new stdClass();
    $updates->last_checked = time();
    $updates->response     = array();
    $updates->translations = array();
    $updates->no_update    = array();

    $doing_cron = wp_doing_cron();

    // Check for update on a different schedule, depending on the page.     switch ( current_filter() ) {
        case 'upgrader_process_complete':
            $timeout = 0;
            break;
        case 'load-update-core.php':
            $timeout = MINUTE_IN_SECONDS;
            break;
        case 'load-plugins.php':
        case 'load-update.php':
            $timeout = HOUR_IN_SECONDS;
            break;
        default:
            

function wp_filter_content_tags( $content$context = null ) {
    if ( null === $context ) {
        $context = current_filter();
    }

    $add_iframe_loading_attr = wp_lazy_loading_enabled( 'iframe', $context );

    if ( ! preg_match_all( '/<(img|iframe)\s[^>]+>/', $content$matches, PREG_SET_ORDER ) ) {
        return $content;
    }

    // List of the unique `img` tags found in $content.     $images = array();

    


        if ( empty( $language_updates ) ) {
            $this->skin->header();
            $this->skin->set_result( true );
            $this->skin->feedback( 'up_to_date' );
            $this->skin->bulk_footer();
            $this->skin->footer();
            return true;
        }

        if ( 'upgrader_process_complete' === current_filter() ) {
            $this->skin->feedback( 'starting_upgrade' );
        }

        // Remove any existing upgrade filters from the plugin/theme upgraders #WP29425 & #WP29230.         remove_all_filters( 'upgrader_pre_install' );
        remove_all_filters( 'upgrader_clear_destination' );
        remove_all_filters( 'upgrader_post_install' );
        remove_all_filters( 'upgrader_source_selection' );

        add_filter( 'upgrader_source_selection', array( $this, 'check_package' ), 10, 2 );

        

function is_main_query() {
    global $wp_query;

    if ( ! isset( $wp_query ) ) {
        _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '6.1.0' );
        return false;
    }

    if ( 'pre_get_posts' === current_filter() ) {
        _doing_it_wrong(
            __FUNCTION__,
            sprintf(
                /* translators: 1: pre_get_posts, 2: WP_Query->is_main_query(), 3: is_main_query(), 4: Documentation URL. */
                __( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ),
                '<code>pre_get_posts</code>',
                '<code>WP_Query->is_main_query()</code>',
                '<code>is_main_query()</code>',
                __( 'https://developer.wordpress.org/reference/functions/is_main_query/' )
            ),
            '3.7.0'
        );
function _make_clickable_rel_attr( $url ) {
    $rel_parts        = array();
    $scheme           = strtolower( wp_parse_url( $url, PHP_URL_SCHEME ) );
    $nofollow_schemes = array_intersect( wp_allowed_protocols(), array( 'https', 'http' ) );

    // Apply "nofollow" to external links with qualifying URL schemes (mailto:, tel:, etc... shouldn't be followed).     if ( ! wp_is_internal_link( $url ) && in_array( $scheme$nofollow_schemes, true ) ) {
        $rel_parts[] = 'nofollow';
    }

    // Apply "ugc" when in comment context.     if ( 'comment_text' === current_filter() ) {
        $rel_parts[] = 'ugc';
    }

    $rel = implode( ' ', $rel_parts );

    /** * Filters the rel value that is added to URL matches converted to links. * * @since 5.3.0 * * @param string $rel The rel value. * @param string $url The matched URL being converted to a link tag. */
/** * Displays plugin content based on plugin list. * * @since 2.7.0 * * @global WP_List_Table $wp_list_table */
function display_plugins_table() {
    global $wp_list_table;

    switch ( current_filter() ) {
        case 'install_plugins_beta':
            printf(
                /* translators: %s: URL to "Features as Plugins" page. */
                '<p>' . __( 'You are using a development version of WordPress. These feature plugins are also under development. <a href="%s">Learn more</a>.' ) . '</p>',
                'https://make.wordpress.org/core/handbook/about/release-cycle/features-as-plugins/'
            );
            break;
        case 'install_plugins_featured':
            printf(
                /* translators: %s: https://wordpress.org/plugins/ */
                '<p>' . __( 'Plugins extend and expand the functionality of WordPress. You may install plugins in the <a href="%s">WordPress Plugin Directory</a> right from here, or upload a plugin in .zip format by clicking the button at the top of this page.' ) . '</p>',
                
return remove_all_filters( $hook_name$priority );
}

/** * Retrieves the name of the current action hook. * * @since 3.9.0 * * @return string Hook name of the current action. */
function current_action() {
    return current_filter();
}

/** * Returns whether or not an action hook is currently being processed. * * The function current_action() only returns the most recent action being executed. * did_action() returns the number of times an action has been fired during * the current request. * * This function allows detection for any action currently being executed * (regardless of whether it's the most recent action to fire, in the case of * hooks called from hook callbacks) to be verified. * * @since 3.9.0 * * @see current_action() * @see did_action() * * @param string|null $hook_name Optional. Action hook to check. Defaults to null, * which checks if any action is currently being run. * @return bool Whether the action is currently in the stack. */
/** * Sanitize content with allowed HTML KSES rules. * * This function expects slashed data. * * @since 1.0.0 * * @param string $data Content to filter, expected to be escaped with slashes. * @return string Filtered content. */
function wp_filter_kses( $data ) {
    return addslashes( wp_kses( stripslashes( $data )current_filter() ) );
}

/** * Sanitize content with allowed HTML KSES rules. * * This function expects unslashed data. * * @since 2.9.0 * * @param string $data Content to filter, expected to not be escaped. * @return string Filtered content. */

function wp_get_theme_preview_path( $current_stylesheet = null ) {
    if ( ! current_user_can( 'switch_themes' ) ) {
        return $current_stylesheet;
    }

    $preview_stylesheet = ! empty( $_GET['wp_theme_preview'] ) ? sanitize_text_field( wp_unslash( $_GET['wp_theme_preview'] ) ) : null;
    $wp_theme           = wp_get_theme( $preview_stylesheet );
    if ( ! is_wp_error( $wp_theme->errors() ) ) {
        if ( current_filter() === 'template' ) {
            $theme_path = $wp_theme->get_template();
        } else {
            $theme_path = $wp_theme->get_stylesheet();
        }

        return sanitize_text_field( $theme_path );
    }

    return $current_stylesheet;
}


function get_the_generator( $type = '' ) {
    if ( empty( $type ) ) {

        $current_filter = current_filter();
        if ( empty( $current_filter ) ) {
            return;
        }

        switch ( $current_filter ) {
            case 'rss2_head':
            case 'commentsrss2_head':
                $type = 'rss2';
                break;
            case 'rss_head':
            case 'opml_head':
                

function wp_deregister_script( $handle ) {
    global $pagenow;

    _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );

    /** * Do not allow accidental or negligent de-registering of critical scripts in the admin. * Show minimal remorse if the correct hook is used. */
    $current_filter = current_filter();
    if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) ||
        ( 'wp-login.php' === $pagenow && 'login_enqueue_scripts' !== $current_filter )
    ) {
        $not_allowed = array(
            'jquery',
            'jquery-core',
            'jquery-migrate',
            'jquery-ui-core',
            'jquery-ui-accordion',
            'jquery-ui-autocomplete',
            'jquery-ui-button',
            
Home | Imprint | This part of the site doesn't use cookies.