Closed unfulvio closed 11 years ago
Works fine for me in Version 3.5.7.2 and WP 3.5
I've upgraded to ACF latest, but the problem is still there, I've inspected my code, I'm not including this addon twice, neither I have other addons conflicting or other plugins interacting with ACF installed... Also checked the file for any whitespace issue, it doesn't seem to be that.
This looks like a similar issue on a different ACF addon: https://github.com/GCX/acf-taxonomy-field/issues/43
@Mompracem could you confirm what version of PHP you are running? I have set this up on my testing server running WP 3.5, ACF Version 3.5.7.2 on PHP version 5.3.5 and have not been able to recreate this issue.
I was using 5.3 and now updated to 5.4 same issue
I also updated MySQL to 5.5 the other day, no changes
Not an ideal solution but have you tired wrapping your register_field in an if ( class_exists ) ?
it was wrapped in if ( function_exists ) as per instructions
doesn't make a difference with class
I tried also with if ( !class_exists( 'Users_field' ) ) among other combinations, but also in this case throws the same error - I assume you wanted to check whether a class 'Users_field was declared before registering the new field, but apparently it wasn't since even doing so throws the same error...
fixed it
I had to hack the addon file and wrapping it with
if( !class_exists( 'Users_field' ) && class_exists( 'acf_Field' ) )
I was wrapping the register_field function in functions.php to load the addon - that one is fine to wrap with a condition to check if register_field function exists, but the class exist conditional has to be inside users_field.php
I get this error message:
Fatal error: Cannot redeclare class Users_field in ---[path]----users-field.php on line 434