apply_filters example


        $this->providers = apply_filters( 'oembed_providers', $providers );

        // Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop().         add_filter( 'oembed_dataparse', array( $this, '_strip_newlines' ), 10, 3 );
    }

    /** * Exposes private/protected methods for backward compatibility. * * @since 4.0.0 * * @param string $name Method to call. * @param array $arguments Arguments to pass when calling. * @return mixed|false Return value of the callback, false otherwise. */
/** * Filters the returned embed HTML. * * @since 2.9.0 * * @see WP_Embed::shortcode() * * @param string|false $return The HTML result of the shortcode, or false on failure. * @param string $url The embed URL. * @param array $attr An array of shortcode attributes. */
                        return apply_filters( 'embed_handler_html', $return$url$attr );
                    }
                }
            }
        }

        return false;
    }

    /** * The do_shortcode() callback function. * * Attempts to convert a URL into embed HTML. Starts by checking the URL against the regex of * the registered embed handlers. If none of the regex matches and it's enabled, then the URL * will be given to the WP_oEmbed class. * * @param array $attr { * Shortcode attributes. Optional. * * @type int $width Width of the embed in pixels. * @type int $height Height of the embed in pixels. * } * @param string $url The URL attempting to be embedded. * @return string|false The embed HTML on success, otherwise the original URL. * `->maybe_make_link()` can return false on failure. */
/* * Get all available templates for the post/page attributes meta-box. * The "Default template" array element should only be added if the array is * not empty so we do not trigger the template select element without any options * besides the default value. */
$available_templates = wp_get_theme()->get_page_templates( get_post( $post->ID ) );
$available_templates = ! empty( $available_templates ) ? array_replace(
    array(
        /** This filter is documented in wp-admin/includes/meta-boxes.php */
        '' => apply_filters( 'default_page_template_title', __( 'Default template' ), 'rest-api' ),
    ),
    $available_templates
) : $available_templates;

// Lock settings. $user_id = wp_check_post_lock( $post->ID );
if ( $user_id ) {
    $locked = false;

    /** This filter is documented in wp-admin/includes/post.php */
    if ( apply_filters( 'show_post_locked_dialog', true, $post$user_id ) ) {
        

            $quality = apply_filters( 'wp_editor_set_quality', $default_quality$mime_type );

            if ( 'image/jpeg' === $mime_type ) {
                /** * Filters the JPEG compression quality for backward-compatibility. * * Applies only during initial editor instantiation, or when set_quality() is run * manually without the `$quality` argument. * * The WP_Image_Editor::set_quality() method has priority over the filter. * * The filter is evaluated under two contexts: 'image_resize', and 'edit_image', * (when a JPEG image is saved to file). * * @since 2.5.0 * * @param int $quality Quality level between 0 (low) and 100 (high) of the JPEG. * @param string $context Context of the filter. */

            $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
            ?> <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" aria-describedby="slug-description" /> <p class="description" id="slug-description"><?php echo $tax->labels->slug_field_description; ?></p></td> </tr> <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?> <tr class="form-field term-parent-wrap"> <th scope="row"><label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label></th> <td> <?php                 $dropdown_args = array(
                    'hide_empty'       => 0,
                    
/** * Filters whether a user should be added to a site. * * @since 4.9.0 * * @param true|WP_Error $retval True if the user should be added to the site, error * object otherwise. * @param int $user_id User ID. * @param string $role User role. * @param int $blog_id Site ID. */
    $can_add_user = apply_filters( 'can_add_user_to_blog', true, $user_id$role$blog_id );

    if ( true !== $can_add_user ) {
        restore_current_blog();

        if ( is_wp_error( $can_add_user ) ) {
            return $can_add_user;
        }

        return new WP_Error( 'user_cannot_be_added', __( 'User cannot be added to this site.' ) );
    }

    
<?php         $duration = 'hourly';

        /** * Filters how often to update the RSS feed. * * @since 2.1.0 * * @param string $duration The update period. Accepts 'hourly', 'daily', 'weekly', 'monthly', * 'yearly'. Default 'hourly'. */
        echo apply_filters( 'rss_update_period', $duration );
    ?> </sy:updatePeriod> <sy:updateFrequency> <?php         $frequency = '1';

        /** * Filters the RSS update frequency. * * @since 2.1.0 * * @param string $frequency An integer passed as a string representing the frequency * of RSS updates within the update period. Default '1'. */
<?php _e( 'Size' ); ?></label> <select id="attachment-display-settings-size" class="size" name="size" data-setting="size" <# if ( data.userSettings ) { #> data-user-setting="imgsize" <# } #>> <?php                     /** This filter is documented in wp-admin/includes/media.php */
                    $sizes = apply_filters(
                        'image_size_names_choose',
                        array(
                            'thumbnail' => __( 'Thumbnail' ),
                            'medium'    => __( 'Medium' ),
                            'large'     => __( 'Large' ),
                            'full'      => __( 'Full Size' ),
                        )
                    );

                    foreach ( $sizes as $value => $name ) :
                        ?>
if ( 'attachment' === get_post_type() && wp_attachment_is_image() ) {
            $thumbnail_id = get_the_ID();
        }

        /** * Filters the thumbnail image ID for use in the embed template. * * @since 4.9.0 * * @param int|false $thumbnail_id Attachment ID, or false if there is none. */
        $thumbnail_id = apply_filters( 'embed_thumbnail_id', $thumbnail_id );

        if ( $thumbnail_id ) {
            $aspect_ratio = 1;
            $measurements = array( 1, 1 );
            $image_size   = 'full'; // Fallback.
            $meta = wp_get_attachment_metadata( $thumbnail_id );
            if ( ! empty( $meta['sizes'] ) ) {
                foreach ( $meta['sizes'] as $size => $data ) {
                    if ( $data['height'] > 0 && $data['width'] / $data['height'] > $aspect_ratio ) {
                        $aspect_ratio = $data['width'] / $data['height'];
                        

        $search_columns = (array) apply_filters( 'post_search_columns', $search_columns$q['s']$this );

        // Use only supported search columns.         $search_columns = array_intersect( $search_columns$default_search_columns );
        if ( empty( $search_columns ) ) {
            $search_columns = $default_search_columns;
        }

        /** * Filters the prefix that indicates that a search term should be excluded from results. * * @since 4.7.0 * * @param string $exclusion_prefix The prefix. Default '-'. Returning * an empty value disables exclusions. */
/** * Renders the `core/latest-comments` block on server. * * @param array $attributes The block attributes. * * @return string Returns the post content with latest comments added. */
function render_block_core_latest_comments( $attributes = array() ) {
    $comments = get_comments(
        /** This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php */
        apply_filters(
            'widget_comments_args',
            array(
                'number'      => $attributes['commentsToShow'],
                'status'      => 'approve',
                'post_status' => 'publish',
            ),
            array()
        )
    );

    $list_items_markup = '';
    
foreach ( $views as $class => $view ) {
                            echo "\t$view\n";
                        }
                    }
                    ?> </select> <?php                 $this->extra_tablenav( 'bar' );

                /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
                $views = apply_filters( "views_{$this->screen->id}", array() );

                // Back compat for pre-4.0 view links.                 if ( ! empty( $views ) ) {
                    echo '<ul class="filter-links">';
                    foreach ( $views as $class => $view ) {
                        echo "<li class='$class'>$view</li>";
                    }
                    echo '</ul>';
                }
                ?> </div> <div class="search-form"> <p class="search-box"> <label class="screen-reader-text" for="media-search-input">
$ver = $scripts->registered[ $handle ]->ver;

        if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $scripts->content_url && str_starts_with( $src$scripts->content_url ) ) ) {
            $src = $scripts->base_url . $src;
        }

        if ( ! empty( $ver ) ) {
            $src = add_query_arg( 'ver', $ver$src );
        }

        /** This filter is documented in wp-includes/class-wp-scripts.php */
        $src = esc_url( apply_filters( 'script_loader_src', $src$handle ) );

        if ( ! $src ) {
            continue;
        }

        $polyfill .= (
            // Test presence of feature...             '( ' . $test . ' ) || ' .
            /* * ...appending polyfill on any failures. Cautious viewers may balk * at the `document.write`. Its caveat of synchronous mid-stream * blocking write is exactly the behavior we need though. */


    /** * Allows a plugin to override the WordPress.org Translation Installation API entirely. * * @since 4.0.0 * * @param false|array $result The result array. Default false. * @param string $type The type of translations being requested. * @param object $args Translation API arguments. */
    $res = apply_filters( 'translations_api', false, $type$args );

    if ( false === $res ) {
        $url      = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
        $http_url = $url;
        $ssl      = wp_http_supports( array( 'ssl' ) );
        if ( $ssl ) {
            $url = set_url_scheme( $url, 'https' );
        }

        $options = array(
            'timeout' => 3,
            
public function wp_set_background_image() {
        check_ajax_referer( 'custom-background' );

        if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['attachment_id'] ) ) {
            exit;
        }

        $attachment_id = absint( $_POST['attachment_id'] );

        $sizes = array_keys(
            /** This filter is documented in wp-admin/includes/media.php */
            apply_filters(
                'image_size_names_choose',
                array(
                    'thumbnail' => __( 'Thumbnail' ),
                    'medium'    => __( 'Medium' ),
                    'large'     => __( 'Large' ),
                    'full'      => __( 'Full Size' ),
                )
            )
        );

        $size = 'thumbnail';
        
Home | Imprint | This part of the site doesn't use cookies.