[wp-hackers] How to filter the URL of each menu item

Pasquale Puzio pasquale.puzio at gmail.com
Mon Jan 16 12:55:44 UTC 2012


I've found the answer by myself, again :-)

The filter in question is 'wp_nav_menu_objects'. Through this filter
we can access a parameter called $sorted_menu_items which is an array
containing an object for each menu item.

On Mon, Jan 16, 2012 at 1:45 PM, Pasquale Puzio
<pasquale.puzio at gmail.com> wrote:
> Maybe, I've found the answer:
> http://wpfirstaid.com/2010/10/extend-the-wordpress-menu/
>
> Unfortunately, the filter mentioned in that article allows me to edit
> only the HTML code but for me it would be easier to edit a kind of
> data structure.
>
> On Mon, Jan 16, 2012 at 1:27 PM, Pasquale Puzio
> <pasquale.puzio at gmail.com> wrote:
>> Hi all,
>>
>> I would like to filter the URL of each menu item, not at the moment of
>> saving the menu but during a frontend request by an user.
>> My goal is to change the URL of some menu items when the user is not
>> logged. For example, if an user is not logged I want to change the URL
>> of a certain menu item in "javascript:alert(bla bla bla)".
>> Does there exist a filter to do so? Could you please give me a reference?
>>
>> Thanks
>>
>> --
>> Dott. Pasquale Puzio
>> http://www.pasqualepuzio.it
>> info at pasqualepuzio.it
>> 340 5026359
>
>
>
> --
> Dott. Pasquale Puzio
> http://www.pasqualepuzio.it
> info at pasqualepuzio.it
> 340 5026359



-- 
Dott. Pasquale Puzio
http://www.pasqualepuzio.it
info at pasqualepuzio.it
340 5026359


More information about the wp-hackers mailing list