Resolving WordPress Widgets Snapping Shut

January 23rd, 2014 - Posted by Steve Marks to PHP, Web Development.

I came across a peculiar problem recently when setting up widgets for a WordPress site I was working on. In summary, I was registering sidebars and adding widgets when a scenario arose whereby I was unable add widgets.

I would drag and drop an available widget into the respective sidebar and it would snap shut, preventing me from making changes to it.

After a bit of debugging I found the cause to be in my themes functions.php file and the fact I had some whitespace in it. An example of this can be found below:


// Some code here



// Some more code here


Once I’d removed the whitespace and ensured all the code was between a single set of PHP tags the widgets then began to act as expected.

Tags: ,
This entry was posted on Thursday, January 23rd, 2014 at 11:15 am by +Steve Marks and is filed under PHP, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.

Fear not, we won't publish this

Comments (0)

No comments have been left yet. Be the first