Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizer doesn't load if ACF (Pro) is active #1302

Closed
mapsteps opened this issue Apr 24, 2017 · 11 comments
Closed

Customizer doesn't load if ACF (Pro) is active #1302

mapsteps opened this issue Apr 24, 2017 · 11 comments
Milestone

Comments

@mapsteps
Copy link
Contributor

Issue description:

Hey there,

figured that the customizer gets stuck, throwing the following error if ACF Pro (not tested with the regular version) is active:

"Error: Option 'data' is not allowed for Select2 when attached to a element." Version used: Latest dev

@aristath
Copy link
Contributor

aristath commented Apr 24, 2017

what kind of controls are you using?
select2 is used in select, typography and repeater controls...
Which file is it that throws this error in the console?

@mapsteps
Copy link
Contributor Author

I've just created a new site and was only using a textarea field.
With kirki, I use several typography fields, etc.
File: advanced-custom-fields-pro/assets/inc/select2/3/select2.min.js

@hellor0bot
Copy link

@mapsteps, add this to your functions.php and update ACF Pro to the latest version:

/**
 * Change Select 2 version
 */
function kirki_acf_select2_version() {
	return 4;
}
add_filter( 'acf/settings/select2_version', 'kirki_acf_select2_version' );

It will force ACF Pro to use the latest version of select2.

@mapsteps
Copy link
Contributor Author

@hellor0bot, that works for me, thanks!

I am running the latest ACF Pro version. Just tried it on a fresh install and figured that the error occurs by just having ACF Pro activated.

Thanks again!
Best,
David

aristath added a commit that referenced this issue Apr 25, 2017
@aristath
Copy link
Contributor

Added to the plugin too 👍
Thanks @hellor0bot!

@hellor0bot
Copy link

@aristath Glad I could be helpful :)

I think we should specifically target the customizer view by adding this:

/**
 * Change Select 2 version
 */
function kirki_acf_select2_version() {
	if ( is_customize_preview() ) {
		return 4;
	}
}
add_filter( 'acf/settings/select2_version', 'kirki_acf_select2_version' );

The reason, why Elliot from ACF doesn't update Select to v4 is because the v4 doesn't have the sorting feature. ACF obviously enqueues its Select2 script for supporting widgets in the Customizer. So we can override the Select2 version for ACF Pro only on the Customizer screen with the conditional tag. I've just tested it and its' working fine.

@aristath aristath reopened this Apr 26, 2017
aristath added a commit that referenced this issue Apr 27, 2017
@aristath
Copy link
Contributor

Done. 👍

@aristath aristath modified the milestone: 3.0 Apr 27, 2017
@mapsteps
Copy link
Contributor Author

mapsteps commented Jun 4, 2017

Issue is back. (ACF Pro - Version 5.5.14)

acf-kirki-font-issue

@aristath aristath reopened this Jun 4, 2017
@aristath
Copy link
Contributor

aristath commented Jun 4, 2017

fixed

@mapsteps mapsteps changed the title Customizer doesn't load if ACF PRO is active Customizer doesn't load if ACF (Pro) is active Jun 4, 2017
@mapsteps
Copy link
Contributor Author

Hey @aristath,

not sure if this can be removed. I've just discovered that ACF updated the Select2 js library to v4

select2

aristath added a commit that referenced this issue Jul 30, 2017
@aristath
Copy link
Contributor

(y) removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants