Skip to content

Commit

Permalink
feat(api): adds filter to disable image replacement on a specific pag…
Browse files Browse the repository at this point in the history
…e/ur
  • Loading branch information
selul committed Mar 10, 2019
1 parent 9c0e0fb commit 3250a8d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions inc/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ public function init() {
* @return bool If we can replace the image.
*/
public function should_replace() {
if ( self::is_ajax_request() ) {
return true;

if ( apply_filters( 'optml_should_replace_page', false ) ) {
return false;
}
if ( is_admin() || ! $this->settings->is_connected() || ! $this->settings->is_enabled() || is_customize_preview() ) {

if ( ( is_admin() && ! self::is_ajax_request() ) || ! $this->settings->is_connected() || ! $this->settings->is_enabled() || is_customize_preview() ) {
return false; // @codeCoverageIgnore
}

Expand Down

0 comments on commit 3250a8d

Please sign in to comment.