Skip to content

Commit b2c0f4e

Browse files
tijmenbruggemanrkoopmans
authored andcommitted
feat(plugin): add tiny_replace_with_picture filter to toggle <img> to <picture> replacement
Defaults to true; when set to false via the filter, Tiny_Picture is not instantiated and images are not replaced. Adds WordPress-style DocBlock with @SInCE 3.7.0.
1 parent 23dff46 commit b2c0f4e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/class-tiny-plugin.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,16 @@ public function init() {
6767
);
6868

6969
if ( $this->settings->get_conversion_enabled() ) {
70-
new Tiny_Picture( ABSPATH, array( get_site_url() ) );
70+
/**
71+
* Controls wether the page should replace <img> with <picture> elements
72+
* converted sources.
73+
*
74+
* @since 3.7.0
75+
*/
76+
$should_replace = apply_filters( 'tiny_replace_with_picture', true );
77+
if ( $should_replace ) {
78+
new Tiny_Picture( ABSPATH, array( get_site_url() ) );
79+
}
7180
}
7281
}
7382

0 commit comments

Comments
 (0)