[wp-trac] Re: [WordPress Trac] #4062: Implicit global var references in menu-header.php

WordPress Trac wp-trac at lists.automattic.com
Sat Mar 31 21:38:21 GMT 2007


#4062: Implicit global var references in menu-header.php
----------------------------+-----------------------------------------------
 Reporter:  rgovostes       |        Owner:  anonymous
     Type:  defect          |       Status:  new      
 Priority:  low             |    Milestone:  2.4      
Component:  Administration  |      Version:  2.1.2    
 Severity:  normal          |   Resolution:           
 Keywords:                  |  
----------------------------+-----------------------------------------------
Comment (by rgovostes):

 I am writing a plugin to replace WordPress's page editor. I was originally
 doing this by starting an output buffer in the admin_header and then
 replacing the contents of the buffer with my custom PHP file, but I ran
 into problems with WP_Scripts not outputting JavaScript calls that had
 already been printed in the "first rendering."

 My second solution was to exploit the fact that pages.php calls
 wp_redirect if the action specified isn't handled by its switch. First, I
 rewrote all the Edit links in the pages list to use a different action.
 (thus, #4058). Then I used a filter on wp_redirect to handle the action
 myself -- including the admin header, the new form, and finally, the admin
 footer.

 However, I was getting PHP errors from the script that generates the
 menubar because $menu wasn't defined (in the foreach loop, line 8). The
 solution was to write "global $menu, $submenu, ..." on the line before I
 include'd the header.

 If there is a better way than how I'm going about this, save for replacing
 the in-built edit form, I'd be open to hear it. It seems that each method
 I've looked into requires hacks and workarounds...

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4062#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list