Support » Plugin: Jobs for WordPress » Filter bug (PHP code)

  • Resolved hakon81

    (@hakon81)


    Hello,

    if plugin is still in development, i ran into another bug.
    Plugins apply a filter to nav_menu_css_class
    add_action( 'nav_menu_css_class', array('Job_Postings', 'add_current_nav_class'), 10, 2 );

    Code of it:

    	public static function add_current_nav_class($classes, $item) {
    		global $post;
    
    		if( !$post ) return; 

    This destroys my site if there is no $post. You check for $post which is good, however you dont return the correct parameters (classes).
    This will destroy apply filters like this (in cases where post is not defined)

    
    $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
    

    Because it returns nothing.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.