[wp-trac] [WordPress Trac] #40796: Overriding WordPress globals is prohibited

WordPress Trac noreply at wordpress.org
Thu May 18 07:47:05 UTC 2017


#40796: Overriding WordPress globals is prohibited
-----------------------------+------------------------------
 Reporter:  maneshtimilsina  |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Bundled Theme    |     Version:  4.7.5
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by maneshtimilsina):

 Hi @swissspidy

 Thanks for reply.

 Yes, `global $post` on line 142 has no use. Also, if `$id` returns integer
 value is not checked anywhere.

 Next, `$post` is overridden to use its ID in `content-front-page-
 panels.php` we can get this option by creating custom global variable and
 assigning post ID. We need to change `the_title()` in `content-front-page-
 panels.php` to `get_the_title( $global_variable )`

 If you like to test, I can provide you working code.

 Thank you.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40796#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list