1

I created new theme with name for example XYZ. its good till now but the issue comes before few days. Wordpress repository has a theme with same name as my theme's name. Now the issue is when the updates comes for wordpress theme, the update notification is display for my themes also. So what can i do for this ?

Thanks, Aezaz

3

WP checks for updates by sending data about all plugins and themes to the repository. To prevent false update messages for your own code you need to selectively scrub it out of those requests.

The example for theme by Mark Jaquith:

function cws_hidden_theme_12345( $r, $url ) {
    if ( 0 !== strpos( $url, 'http://api.wordpress.org/themes/update-check' ) )
        return $r; // Not a theme update request. Bail immediately.
    $themes = unserialize( $r['body']['themes'] );
    unset( $themes[ get_option( 'template' ) ] );
    unset( $themes[ get_option( 'stylesheet' ) ] );
    $r['body']['themes'] = serialize( $themes );
    return $r;
}

add_filter( 'http_request_args', 'cws_hidden_theme_12345', 5, 2 );

See excluding your plugin or theme from update checks for full post with details.

  • tried this but no success. – Shaikh Aezaz Sep 14 '13 at 12:03
  • Also its only works when my theme is active and i think its not working in multisite. :( – Shaikh Aezaz Sep 14 '13 at 12:03
  • 1
    I'm guessing you can replace unset( $themes[ get_option( 'template' ) ] ); with unset( $themes['theme-slug'] );. Also, details such as the Theme being active or not, and being in a multisite environment are necessary details in your original question. – Chip Bennett Sep 14 '13 at 12:40
  • @Chip Bennett trying your suggestion as well but no luck. – Shaikh Aezaz Sep 16 '13 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.