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.
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.
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
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!