Return content early if not images found
This filter adds attributes for the lightbox, but it is resource-intensive. Returning early if there are no images saves those resources.
This commit is contained in:
parent
820753f148
commit
1fdcff147f
@ -531,7 +531,7 @@ add_filter( 'the_content', 'fictioneer_add_chapter_paragraph_id', 10, 1 );
|
||||
*/
|
||||
|
||||
function fictioneer_add_lightbox_to_post_images( $content ) {
|
||||
if ( empty( $content ) ) {
|
||||
if ( empty( $content ) || strpos( $content, '<img' ) === false ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user