forum share
   textsms      forum    

Disable requests to wp.org repository for active themes

INDEX \ Articole/intrebari \ Disable requests to wp.org repository for active themes

Disable requests to wp.org repository for active themes

text_format+  text_format-


INFO: Open functions.php and add this function!

/**
     * Disable requests to wp.org repository for this theme.
     * Only for active theme!
     * @since 1.0.0
*/
    function prefix_disable_wporg_request( $r, $url ) {

        // If it's not a theme update request, bail.
        if ( 0 !== strpos( $url, 'https://api.wordpress.org/themes/update-check/1.1/' ) ) {
                return $r;
            }

            // Decode the JSON response
            $themes = json_decode( $r['body']['themes'] );

            // Remove the active parent and child themes from the check
            $parent = get_option( 'template' );
            $child = get_option( 'stylesheet' );
            unset( $themes->themes->$parent );
            unset( $themes->themes->$child );
         
            // Encode the updated JSON response
            $r['body']['themes'] = json_encode( $themes );
            return $r;
    }
    add_filter( 'http_request_args', array( $this, 'prefix_disable_wporg_request' ), 5, 2 );





update Ultima actualizare: 23/01/2017
done Informatiile cuprinse in aceasta sectiune sunt verificate si actualizate periodic.

list Articole recente
arrow_back Inapoi


© 2025 EVIDWEB. Toate drepturile rezervate. Design: EVIDWEB

share   forum   textsms