[wp-trac] [WordPress Trac] #47139: function wp_logout_url urlencode causes issues in items wrap nav walker.

WordPress Trac noreply at wordpress.org
Mon May 6 14:42:44 UTC 2019


#47139: function wp_logout_url urlencode causes issues in items wrap nav walker.
--------------------------+-----------------------------
 Reporter:  BackuPs       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hi

 The function wp_logout_url returns a encoded logout url. This used to work
 before without any issues.


 {{{
 string(128) "http://wprtdev.tst/wp-
 login.php?action=logout&_wpnonce=72f1be58e4&redirect_to=http%3A%2F%2Fwprtdev.tst%2F%3Floggedout%3Dtrue"
 }}}


 But if you parse this url as a list element in the menu walker you get a
 warning and error

 {{{

 <b>Warning</b>:  sprintf(): Too few arguments in
 <b>/var/docs/wprtdev.tst/public/wp-includes/nav-menu-template.php</b> on
 line <b>261</b><br />
 }}}


 because the walker uses %3$s for the items wrap and the encoded url has
 %3Afor : and %3F for ?

 It is not possible to add a logout url into the items wrap like this


 {{{
 'items_wrap'=>'<ul id="%1$s" class="%2$s">%3$s<li id="woo-menu-logon-main"
 class="menu-item menu-item-type-post_type"><a href="http://wprtdev.tst/wp-
 login.php?action=logout&_wpnonce=72f1be58e4&redirect_to=http%3A%2F%2Fwprtdev.tst%2Fblog%3Floggedout%3Dtrue"
 title="Logout from shop" itemprop="url"><i class="wooicon icon icon-
 exit"></i>Logout</a></li>',
 }}}

 How to fix this?

 Thank you !

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47139>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list