Skip to content

Commit

Permalink
release: v3.9.2
Browse files Browse the repository at this point in the history
### Bug Fixes
- **Fatal error**: In some edge-cases, the Hero Preloader feature was throwing a fatal error, trying to access inexistent posts.
- **Lazyload default status**: Lazyload was off for new users by default when it should have been on.
  • Loading branch information
abaicus authored Aug 10, 2023
2 parents 0c3e431 + 4264b4e commit f0649cf
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
1 change: 1 addition & 0 deletions inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public function update_default_settings() {
}

$this->settings->update( 'limit_dimensions', 'enabled' );
$this->settings->update( 'lazyload', 'enabled' );

update_option( self::NEW_USER_DEFAULTS_UPDATED, 'yes' );
}
Expand Down
2 changes: 1 addition & 1 deletion inc/hero_preloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function add_preload_to_image_attributes( $attr, $attachment ) {

if ( is_singular() && $queried_post instanceof WP_Post ) {
$post = $queried_post;
} elseif ( $wp_query->is_main_query() && isset( $wp_query->posts[0] ) ) {
} elseif ( $wp_query->is_main_query() && $wp_query->post_count > 0 && isset( $wp_query->posts[0] ) ) {
$post = $wp_query->posts[0];
}

Expand Down
20 changes: 0 additions & 20 deletions inc/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public static function instance() {
add_filter( 'optimole_wp_uninstall_feedback_after_css', [ __CLASS__, 'adds_uf_css' ] );
add_filter( 'optimole_wp_feedback_review_message', [ __CLASS__, 'change_review_message' ] );
add_filter( 'optimole_wp_logger_heading', [ __CLASS__, 'change_review_message' ] );
add_filter( 'optml_default_settings', [ __CLASS__, 'change_lazyload_default' ] );
add_filter( 'optml_register_conflicts', [ __CLASS__, 'register_conflicts' ] );
self::$_instance = new self();
self::$_instance->manager = Optml_Manager::instance();
Expand Down Expand Up @@ -136,25 +135,6 @@ public static function register_conflicts( $conflicts_to_register = [] ) {
return $conflicts_to_register;
}

/**
* Change lazyload default for new users.
*
* @param array $defaults Old defaults.
*
* @return array New defaults.
*/
public static function change_lazyload_default( $defaults ) {
$install_time = get_option( 'optimole_wp_install', 0 );

if ( $install_time < 1545652321 ) {
return $defaults;
}

$defaults['lazyload'] = 'enabled';

return $defaults;
}

/**
* Change review message.
*
Expand Down

0 comments on commit f0649cf

Please sign in to comment.