• Using this code https://paste2.org/p/1464698 to load menu pages with one with a meta box in the admin. Somehow I keep on getting this JavaScript error

    [19:31:41.506] postboxes is not defined @ https://domain.com/wp-admin/admin.php?page=sub-page:131

    Any ideas why this is?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Comment out that <script>...</script> part and see if you get the error. It looks like you are printing javascript from a call to add_sub_menu(). I’m not sure that will work. That function isn’t really intended, as far as I understand it, to be echoing html/css/javascript.

    Usually I would wp_enqueue my scripts rather than print them like that or print it from within a function– usually my own– that is printing markup.

    Thread Starter Rhand

    (@rhand)

    Thanks for the feedback. The script needed to work with the postboxes were not loaded properly because I did not call the proper action for it nor did I do the call on time. Now reworking the code..

    I moved my <script> code to the wp-footer action and now i don’t get the error, but my boxes don’t open/close when i click them. How can i get boxes to toggle open & closed when i click the title?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Postboxes not defined’ is closed to new replies.