Because that’s not what apply_filters()
does. You’ll even see the usage guide and examples at your link all use add_filter()
. Also see the official docs on Filters.
Using apply_filters()
makes a value filterable. add_filter()
is used to filter a filterable value by passing a function that does the filtering.
WordPress uses apply_filters('nav_menu_css_class', ...
, which allows you to use add_filter()
to modify its value. So if you want to modify the nav menu CSS classes, you need to add a filter, with add_filter()
.
The reason apply_filters()
is shown in the docs you linked is because it’s showing how that filter was originally defined. Not how to use it.
Related Posts:
- How to highlight the current page in the nav menu?
- Where is definied the theme location for the main menu in a WordPress template?
- Some doubts about WordPress handle the horizontal main menu visualization
- How to add CSS class to custom logo?
- How to add custom css file in theme?
- Do I actually need to link my theme’s style.css in the theme files
- CSS classes for theme
- Add custom classes to anchor in wp_nav_menu
- Are the WordPress Core CSS styles really all nessesary?
- Why I can’t add a CSS style in this WordPress theme?
- How to make a theme with more than one CSS file?
- Editing the custom background CSS
- Select menu on browser resize
- CSS in child theme not overriding the parent theme [closed]
- How to add (css) classes to only one wp_nav_menu()?
- Displaying wp menus by name without using theme locations
- Setting a Default ‘Theme Location’ When Creating a Menu
- Custom Nav Walker Displaying Values in Sub Menu
- Sub folder CSS that’s read by Admin panel
- CSS won’t style output of wp_nav_menu() correctly
- Dequeue a style file which is making website load slow!
- My Admin bar covers my sticky navbar [closed]
- Theme Loading Into Dashboard
- How to make theme elements customizable in wordpress?
- How to edit my theme for full width?
- Which html elements should be styled in wordpress theme
- Font Awesome 5 Free – far working but fas is not? [closed]
- WordPress Unite Theme: Footer isn’t sticking [closed]
- Where am I doing wrong in my theme menu?
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- Admin: sub menu doesnt display under apperance when activate my themes
- 3 Level Deep Navigation Menu Not Showing All Levels
- Theming Using Bootstrap Glyphicons and WordPress Dashicons
- How to add menù section to my WordPress template?
- Having issue with WordPress wp_enqueue_style
- Thesis -style Navigation
- How can I wrap all blog posts image with
- theme style is applied on the dhasboard rather than the website
- LESS not working in WordPress [closed]
- A post with a clear:both in its css destroy the theme design, and the sidebar is moved to the bottom
- Why is my container argument not working for wp_nav_menu() [closed]
- Why I obtain different visualization when I run the website on my local machine and on remote server?
- Can’t change theme name
- How to use the _S framework
- .current_page_ancestor broken in Twenty Eleven
- Is there a list of default generated Gutenberg block CSS? Unable to align video blocks
- how to create/register menu items that can be added to menus later
- 3 Level Menu Navigation (3rd Level not displaying)
- Theme: dropdown hover menu not showing up in IE/Edge
- How can I fix my theme header for my CSS stylesheet?
- Menu names not getting translated
- How to generate a rtl.css file for themes?
- Primary Menu Showing All Pages With No Sub-Nav
- What’s the policy for building a theme that doesn’t support widgets/menus?
- Why the slideshow is not shown in my theme?
- adding navigation to genesis themes
- Custom link color or stylesheets
- How to make navigation a list without a plugin? [duplicate]
- How do I middle-align my header menu items in WordPress [closed]
- How to highlight current menu bar base on the URL?
- What is The Best Way to Make Parallax header effect for wordpress theme ?? pure CSS or using JavaScript? [closed]
- How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?
- Dynamic nav menu with icons [closed]
- Solutions for generating dynamic javascript / CSS
- wp_nav_menu sort order?
- Is it possible to use line break in theme description?
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- How to Handle CSS for Multiple Header header.php Files?
- Which is the simplest theme for WordPress to use it as your base?
- “Cheatin’ uh?” error message on multple theme directories
- “Display Site Title and Tagline” checkbox not working?
- Is it necessary to prefix every css class in a theme framework?
- WordPress empty Nav Menu error
- Storefront child theme not applying parent theme [closed]
- How to place HTML tags in content from the_content()?
- How to i style the elements from the TinyMCE
- Integrate WooCommerce theme with a WordPress theme [closed]
- Automated Footer information
- How do you use WordPress for a website that’s not in a blog format?
- Why wp_nav_menu() doesnt show the proper meny when invoked two consecutive times?
- How to develop a menu like wwe.com?
- How to track a users last visited page?
- Adding content inside the anchor tags within WordPress main nav
- Open portfolio image in light box
- Let visitors show/hide a type of content
- Why do sticky posts show in this menu?
- how to add a badge on product based on filter?
- style variations hurt the editing performance
- Copying a modified theme from one wordpress site to another wordpress site [closed]
- How can I change this SVG shape that’s generated?
- Adding a second logo next to the main one in header
- (Parent) theme Is Not Showing In Theme Selection Panel and Therefore Breaks Child Theme
- Load multiple css simultaneously using functions.php
- Mobile view logo background colour in wordpress
- WordPress two sidebar layout or theme
- Standard Way To Do Custom Work Within A Page?
- How to reuse parts of WordPress site e.g. header, footer, part of header for multiple WordPress sites?
- Add Dynamic Sidebar to Exisiting WordPress Theme [closed]
- Predefine Magazine Style Layouts
- WordPress search field won’t get wider