wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_lazy_loading_enabled › WordPress Function
Since5.5.0
Deprecatedn/a
› wp_lazy_loading_enabled ( $tag_name, $context )
Parameters: (2) |
|
Returns: |
|
Defined at: |
|
Codex: | |
Change Log: |
|
Determines whether to add the `loading` attribute to the specified tag in the specified context.
Related Functions: wp_maybe_load_embeds, wp_lazyload_term_meta, wp_lazyload_comment_meta, wp_lazyload_site_meta, wp_revisions_enabled
Source
function wp_lazy_loading_enabled( $tag_name, $context ) { /* * By default add to all 'img' and 'iframe' tags. * See https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-loading * See https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-loading */ $default = ( 'img' === $tag_name || 'iframe' === $tag_name ); /** * Filters whether to add the `loading` attribute to the specified tag in the specified context. * * @since 5.5.0 * * @param bool $default Default value. * @param string $tag_name The tag name. * @param string $context Additional context, like the current filter name * or the function name from where this was called. */ return (bool) apply_filters( 'wp_lazy_loading_enabled', $default, $tag_name, $context ); }