I pasted my siderbar widget code in widgets.php file

    function right_sidebar_widget() {
    register_sidebar( array(
        'name' => 'Right Siderbar',
        'id' => 'right-siderbar',
        'description' => 'Right Sidebar',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h3 class="widget-title">',
        'after_title' => '</h3>',
    ) );

add_action( 'after_setup_theme', 'right_sidebar_widget' );

included widgets.php file to functions.php file using

include_once 'includes/widgets.php';

But widgets not working, I got the error

The theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please follow these instructions.

Note: I checked, the above code working when in the functions.php and also widgets.php included successfully

  • 2
    If that piece of code is working in functions.php and widgets.php is correctly loaded with the same code but not wrking, there is nothing we can do. Something else must be happening that you have not noted and we can not know if we don't take a closer look to your code and files. Are you sure the code is working when you write it in functions.php? Does your theme have any sidebar.php file or use `dynamic_sidebar( some where??
    – cybmeta
    Commented Apr 7, 2015 at 11:02

1 Answer 1


Change this code

add_action( 'after_setup_theme', 'right_sidebar_widget' );


add_action( 'widgets_init', 'right_sidebar_widget' );
  • also tried, got same error
    – Relax
    Commented Apr 7, 2015 at 10:09
  • Make sure- widgets.php file is included correctly. Try using the code directly in functions.php file and see what happens.
    – mukto90
    Commented Apr 7, 2015 at 10:32
  • code working in function.php and i also checked widgets.php included correctly
    – Relax
    Commented Apr 7, 2015 at 10:44
  • That's strange! The code seems like your widgets.php file is in a directory named includes. Recheck it.
    – mukto90
    Commented Apr 7, 2015 at 11:19

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.