• Hi!
    Just discovered a little problem with Nginx Helper when used on sites with WPML installed.

    Nginx Helper always clears the homepage cache from the default language and not the homepage which the changed post belongs too:

    For example a site with 2 languages (English (default) and German):
    The English-Homepage url looks like https://www.asite.com/ and the german one looks like https://www.asite.com/de
    If you change a german post then the english homepage cache is cleared not the german one!

    After digging through yout code if found a solution:

    in purger.php find function _purge_homepage()

    private function _purge_homepage() {
    
    		    //  WPML installetd?
    			if ( function_exists('icl_get_home_url') )
    			{
    				$homepage_url = trailingslashit( icl_get_home_url() );
    				$this->log( sprintf( __( "Purging homepage (WPML) '%s'", "nginx-helper" ), $homepage_url ) );
    			}
    			else
    			{
    				$homepage_url = trailingslashit( home_url() );
    				$this->log( sprintf( __( "Purging homepage '%s'", "nginx-helper" ), $homepage_url ) );
    			}
    
    			$this->purgeUrl( $homepage_url );
    
    			return true;
    		}

    and find function purgePost( $_ID ) {

    if ( $rt_wp_nginx_helper->options[ 'purge_homepage_on_edit' ] == 1 )
        		{
    				$this->_purge_homepage(); // CHANGED ERICH
    			}

    Hope this would help someone!

    Erich

    https://www.ads-software.com/plugins/nginx-helper/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Wrong homepage cache cleared when WPML Plugin used’ is closed to new replies.