Is there a way to "remove the widget from available widgets" after you've activated it once on some area? The idea is to allow user to activate only one instance of it.

  • There's a similar question here that might have the answer you need.
    – Steve
    Apr 4, 2014 at 7:28
  • I've seen it ofcourse, but the idea is to remove it from "avilable widgets". If anyone wants to help me out, can take a look at the plugin "WP Favorite Posts", which only allows one instance of its "Most Favorited Posts" widget. Thanks in advance! Apr 4, 2014 at 8:49

3 Answers 3


You can create a one-time-use widget with the following example found here: wp_register_sidebar_widget

The following code will create a widget called "Your Widget" which will become available in the WordPress Administrative Panels. The widget can then be dragged to an available sidebar for display.

Note that this widget can only be used once in exactly 1 of the sidebars. For recursive widgets (widgets you can add to multiple times and add to multiple sidebars) please see the Register Widget function.

function your_widget_display($args) {
   echo $before_widget;
   echo $before_title . 'My Unique Widget' . $after_title;
   echo $after_widget;
   // print some HTML for the widget to display here
   echo "Your Widget Test";

    'your_widget_1',        // your unique widget id
    'Your Widget',          // widget name
    'your_widget_display',  // callback function
    array(                  // options
        'description' => 'Description of what your widget does'

You can use JQuery to remove it from "avilable widgets" panel if it has been used once.

  $( document ).ready( function() {
     $( '#widgets-right input[value="widget-id_base"]').each( function () {
       $( '#widgets-left .widget:has(input[value="widget-id_base"])' ).css( 'display', 'none' );
     } ); 
  } );

That is not an really good Idea. Because Themes wich I develope are more complex, so that you have different Sidebars through the different Views.

For Example: Standard-Sidebar: Displays next to the Content Shop-Sidebar: Displays next to the Shop-Overview

So and now I want to place your Widget into both Sidebars, because there is no view, where both sidebars are visible at the same time.

What you search for, is discard the Placement of your widget into an sidebar, where your Widget is still existing, right?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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