Support

Account

Home Forums Backend Issues (wp-admin) ACF Conflict – no events showing in admin area

Solving

ACF Conflict – no events showing in admin area

  • Hi guys, Event (posts) are no longer showing in the WP admin area, put down to the following ACF conflict … any ideas?

    function event_content($content) {
    global $post;
    if ($post->post_type == ‘post’ || $post->post_type == ‘events’) {
    $booklink = get_field(‘booking_link’, $post->ID);
    $location = get_field(‘location’, $post->ID);
    if (!empty($booklink)) $content .= ‘Click here to book‘;
    $gmlocation = get_gmloc($location);
    if ($gmlocation != “”) {
    $content .= ‘<iframe width=”100%” height=”200″ frameborder=”0″ scrolling=”no” marginheight=”0″ marginwidth=”0″ src=”http://maps.google.com/maps?hl=en&q=&#8217;.$gmlocation.’&z=14&iwloc=near&output=embed”></iframe>’;
    }
    $content .= do_shortcode(‘[getsocial app=”sharing_bar”]’);
    }
    return $content;
    }
    add_filter( ‘the_content’, ‘event_content’ );

    Fatal error: Uncaught Error: Call to undefined function get_field() in /home/jacksonslaw/public_html/wp-content/themes/jacksons/functions.php:102 Stack trace: #0 /home/jacksonslaw/public_html/wp-includes/class-wp-hook.php(287): event_content(‘<p>apply_filters(‘<p>apply_filters(”, Array) #5 /home/jacksonslaw/public_html/wp-includes/post-template.php(427): apply_filters(‘get_the_excerpt’, ”, Object(WP_Post)) #6 /home/jacksonslaw/public_html/wp-admin/includes/class-wp-posts-list-table.php(1045): get_the_excerpt() #7 /home/jacksonslaw/public_html/wp-admin/includes/class-wp-posts-list-table.php(955): WP_Po in /home/jacksonslaw/public_html/wp-content/themes/jacksons/functions.php on line 102
    There has been a critical error on your website. Please check your site admin email inbox for instructions.

  • Fatal error: Uncaught Error: Call to undefined function get_field

    means that ACF is not active

  • Thanks John, however, ACF is very active. As in, it’s not de-activated.

    All present and correct – I’ve ran an error log to get the above, checked most logical possibilities but I’m at a loss on this – hence joining this forum for help.

  • Other possibilities

    You’re calling the function before ACF is loaded. I don’t see how this is possible given the code you’re provided. If ACF is loaded it would be so before the “the_content” hook. Unless wp-content/themes/jacksons/functions.php on line 102 is running before ACF is loaded.

    You have a corrupt or missing ACF plugin file. I also don’t see how this is possible as it should cause other errors during WP startup. However you could try reinstalling ACF, this wouldn’t hurt anything.

  • John, thanks – appreciate the help.

    We’ve just tracked it down to our own php issue, the error above must have been coincidental and not related. Typical.

    Sorry!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘ACF Conflict – no events showing in admin area’ is closed to new replies.