Home › Forums › Front-end Issues › WordPress Network User Activation get_field conflict and workaround
Hi, I set up a wordpress network with two sites. I’m using a get_field function in the header.php file of both sites to get a custom field. This all works beautifully for the site under normal conditions. However when I register a new user, this users gets an activation email with a link to siteurl/wp-activate.php?key=somekey This link however turned out blank. It took me some time to figure out that it hangs on the get_field function. Probably because the function is not initialized yet. I wrapped the call to get_field in an ‘if function_exist(‘get_field’)’ wrap which circumvented the problem (without loading the custom field obviously).
Not sure if this is easily to fix, but thought it worth mentioning. The alternative would probably to use a separate php file in the theme for activation. Haven’t looked into that though.
Hi @maarteno
May I ask where the get_field call was coming from? In your functions.php file?
I don’t think the header.php file should have been read when a user is created..
The get_field call is in my header. When you create a new user in the network setup, that user gets an activation email with a link to siteurl/wp-activate.php. That page is rendered via the front-end and hence calls the header. However, without being able to access the get_field function.
Hi @maarteno
Is it normal that the wp-activate.php file is reading in the header.php file?
On my install it is the default WP login page
I’m also having this issue when creating users specifically on a multi-site installation. The registration email sends out a link that goes directly to wp-activate.php which then attempts to render the page. This may be related to: https://core.trac.wordpress.org/ticket/23197
I have the same issue on a mutisite network where I’m using get_field in my header.php and a new user is hitting wp-activate.php.
PHP Fatal error: Call to undefined function get_field() in /wp-content/themes/themename/header.php on line 24
hi Austrin,
did you solved the problem? on our network site we have the same error.
I’m experiencing this issue now. I have a call to the_field on my menu.
Does anyone have any advice?
Fixed using the solution from here: http://mehimali.com.np/wordpress-mutisite-php-fatal-error-call-to-undefined-function-get_field-when-creating-user/
The topic ‘WordPress Network User Activation get_field conflict and workaround’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.