#37404 closed enhancement (maybelater)
nav-menu cache using javascript
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Menus | Keywords: | |
| Focuses: | Cc: |
Description
hello.
as we know, caching of navigation menus cause to loose "current-item" classes...
but there could be a solution:
it will be good, if nav-menu could be cached, but WP-CORE should contain something like this, to set "current-item" classes:
http://wordpress.stackexchange.com/a/232574/33667
Change History (5)
#3
@
10 years ago
better idea! please, why dont you add this to WP-core?:
attach each link ("<a>" tag) the id of the object. for example:
<li> <a class="p284"> </li>
that means POST,with id 284
or
<li> <a class="c284"> </li>
that means category,with id 284
and so on... It will be very good!
for this, there exists a filter:
function add_menu_atts( $atts, $item, $args ) {
$atts['onClick'] = 'return true'; return $atts;
}
add_filter( 'nav_menu_link_attributes', 'add_menu_atts', 10, 3 );
Note: See
TracTickets for help on using
tickets.
Related: #36225