{"id":8857772,"date":"2017-02-28T16:26:22","date_gmt":"2017-02-28T16:26:22","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/undefined-variable-role\/"},"modified":"2017-02-28T16:26:22","modified_gmt":"2017-02-28T16:26:22","slug":"undefined-variable-role","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/undefined-variable-role\/","title":{"rendered":"Undefined variable: $role"},"content":{"rendered":"<p>Not sure when this came up or how it came up but it did. I have this error popping up a few times:<\/p>\n<p><code>PHP Notice:  Undefined variable: role in \/wp-content\/plugins\/editor-menu-and-widget-access\/admin\/menus.php on line 13<\/code><\/p>\n<p>If for whatever reason ( in theory every user should have roles ) this conditional is false:<\/p>\n<p><code>if ( ! empty( $user-&gt;roles ) &amp;&amp; is_array( $user-&gt;roles ) )<\/code><\/p>\n<p>It throws an error. One solution to this would be to just declare $role at above the conditional at the top of the function as <code>$role = false<\/code> since it&#8217;s checking against specific roles. Just a thought, otherwise is a great plugin!<\/p>\n","protected":false},"template":"","class_list":["post-8857772","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/8857772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/8857772\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=8857772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}