Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    What’s the full error message (and which line / file is giving the warning)? Also, what plug-ins/themes do you have installed, and does the warning persist if you disable those themes/plug-ins.

    You can suppress warnings by adding this to your wp-config.php: https://stackoverflow.com/a/1987588.

    Regardless, please do provide the above details – if there’s a bug, even if its just causing a warning, I’d want to fix it ??

    Thread Starter pietgolf

    (@pietgolf)

    It happens when I click on an event in the calendar. There was no warning using wp 4.3.1
    I changed the theme to the standard one from wp but same result.
    The text of the warning is:

    ( ! ) Warning: array_map(): Argument #2 should be an array in C:\wamp\www\ResidentieBeukenhof\Prod2015-12-06\wp-includes\category-template.php on line 1158
    Call Stack
    # Time Memory Function Location
    1 0.0012 249344 {main}( ) ..\index.php:0
    2 0.0021 252552 require( ‘C:\wamp\www\ResidentieBeukenhof\Prod2015-12-06\wp-blog-header.php’ ) ..\index.php:17
    3 1.4930 59285288 require_once( ‘C:\wamp\www\ResidentieBeukenhof\Prod2015-12-06\wp-includes\template-loader.php’ ) ..\wp-blog-header.php:16
    4 1.5041 59449136 include( ‘C:\wamp\www\ResidentieBeukenhof\Prod2015-12-06\wp-content\themes\sparkling\single.php’ ) ..\template-loader.php:89
    5 1.8937 60321728 get_template_part( ) ..\single.php:15
    6 1.8938 60322600 locate_template( ) ..\general-template.php:171
    7 1.8943 60322760 load_template( ) ..\template.php:521
    8 1.8952 60354656 require( ‘C:\wamp\www\ResidentieBeukenhof\Prod2015-12-06\wp-content\themes\sparkling\content-single.php’ ) ..\template.php:564
    9 1.9054 60358848 the_content( ) ..\content-single.php:32
    10 1.9055 60359472 apply_filters( ) ..\post-template.php:230
    11 1.9081 60363480 call_user_func_array:{C:\wamp\www\ResidentieBeukenhof\Prod2015-12-06\wp-includes\plugin.php:235} ( ) ..\plugin.php:235
    12 1.9081 60363592 _eventorganiser_single_event_content( ) ..\plugin.php:235
    13 1.9083 60380360 eo_get_template_part( ) ..\event-organiser-templates.php:309
    14 1.9084 60381248 eo_locate_template( ) ..\event-organiser-templates.php:40
    15 1.9100 60382784 load_template( ) ..\event-organiser-templates.php:94
    16 1.9113 60427968 require( ‘C:\wamp\www\ResidentieBeukenhof\Prod2015-12-06\wp-content\plugins\event-organiser\templates\event-meta-event-single.php’ ) ..\template.php:564
    17 1.9182 60432016 get_the_terms( ) ..\event-meta-event-single.php:73
    18 1.9185 60437864 array_map ( ) ..\category-template.php:1158

    Plugin Author Stephen Harris

    (@stephenharris)

    Can you confirm that the event has no categories?

    This appears to be a bug in WordPress 4.4 – the bug being in get_the_terms() which is where the warning is being generated.

    It seems it was reported here and not identified as a bug in core: https://core.trac.www.ads-software.com/ticket/34723

    I’d recommend suppressing warnings for now.

    Plugin Author Stephen Harris

    (@stephenharris)

    Incidentally an immediate work-around for this would be to enable event tags.

    Doing so shouldn’t affect the front-end view of your site beyond fixing the warning.

    Don’t know if this will fix your entire error message concerning this plugin, but the category-template.php error has been noted with the 4.4 release. As James Huff pointed on WordPress 4.4 Master List a few hours ago, a patch for this problem has been made:

    https://core.trac.www.ads-software.com/attachment/ticket/34723/34723.patch

    To fix, open your category-template.php and replace lines 1144 – 1158…

    function get_the_terms( $post, $taxonomy ) {
    	if ( ! $post = get_post( $post ) )
    		return false;
    
    	$terms = get_object_term_cache( $post->ID, $taxonomy );
    	if ( false === $terms ) {
    		$terms = wp_get_object_terms( $post->ID, $taxonomy );
    		$to_cache = array();
    		foreach ( $terms as $key => $term ) {
    			$to_cache[ $key ] = $term->data;
    		}
    		wp_cache_add( $post->ID, $to_cache, $taxonomy . '_relationships' );
    	}
    
    	$terms = array_map( 'get_term', $terms );

    …with the new code from the patch:

    function get_the_terms( $post, $taxonomy ) {
    	if ( ! $post = get_post( $post ) )
    		return false;
    
    	$terms = get_object_term_cache( $post->ID, $taxonomy );
     	if ( false === $terms ) {
     		$terms = wp_get_object_terms( $post->ID, $taxonomy );
    		if ( ! is_wp_error( $terms ) ) {
    			$to_cache = array();
    			foreach ( $terms as $key => $term ) {
    				$to_cache[ $key ] = $term->data;
    			}
    			wp_cache_add( $post->ID, $to_cache, $taxonomy . '_relationships' );
     		}
     	}
    
    	if ( ! is_wp_error( $terms ) ) {
    		$terms = array_map( 'get_term', $terms );
    	}

    So is now line 1144 – 1162. This fix will be included in the future 4.4.1 I suppose

    Plugin Author Stephen Harris

    (@stephenharris)

    Hi Ronald,

    Yes, the patch you’ve referenced will fix this in the plug-in.

    The bug is call get_the_terms() with a taxonomy that doesn’t exist – which until 4.4 was a perfectly valid. So this will bug will potentially affect many other plug-ins, but it is due to be fixed in 4.4.1.

    However, I’d recommend enabling event tags in Settings > Event Organiser > General as a safer (and easier) work-around to this bug – unless you also have other plug-ins which are impacted by this bug.

    Hi Stephen, thank you for this tip, it works by me fine with WordPress 4.4.

    Thread Starter pietgolf

    (@pietgolf)

    Solved!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WordPress 4.4’ is closed to new replies.