WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to call widgets using it's id? for example I have a sidebar. In this sidebar I put meta widget and tag cloud widget. I have got their id's ($widgets_list): 'meta-2' and 'tag_cloud-2'. How can I call them without dinamic_sidebar function.

foreach($widgets_list as $item){
    if($item =='meta-2'){
        //echo widget with 'meta-2' id here
share|improve this question

You can display the specified widget using the_widget. It takes the class name of the widget as an argument (not ID), so you'll need to know that info to use it, but this allows you to use a widget outside the sidebar.

If you're looking to run some code based on the presence of a plugin, you want to use is_active_widget, which does take the ID as a parameter.

foreach( $widgets_list as $item ) {
    if ( is_active_widget( false, false, $item, true ) ) {
        //do your thing
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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