Support

Account

Forum Replies Created

  • Sweet. I sent a ticket about this to the devs earlier today. Your fix works on my end.

  • I also bundle this internally with my themes/plugins and I addressed this by commenting out line 39 (connect update) and line 42 (settings) in /pro/acf-pro.php. This removes the notification that an update is available. So no need to constantly change the version number or to set one super high.

  • Here’s how I set ACF within my plugins. Works well for me and doesn’t conflict when I have multiple plugins using ACF.

    // Check if ACF is used with another plugin, if not already called, use this one
    if( ! class_exists('acf') ) {
    	
    	// Load only limited functionality
    	define( 'ACF_LITE' , true );
    	
    	// Load the ACF Core
    	include_once( SET_PLUGIN_NAME_DIR . '/includes/acf/acf.php');
    	
    	// Repeater Add-On
    	if( ! class_exists('acf_repeater_plugin') ) {
    		include_once( SET_PLUGIN_NAME_DIR . '/includes/acf/add-ons/acf-repeater/acf-repeater.php');
    	}
    	
    	// Reapeater Collapser Add-on
    	if( ! class_exists( 'acf_repeater_collapser_assets' ) ) {
    		include_once( SET_PLUGIN_NAME_DIR . '/includes/acf/add-ons/acf-repeater-collapser/acf_repeater_collapser.php');
    	}
    
    	// Options Add-on
    	if( ! class_exists('acf_options_page_plugin') ) {
    		include_once( SET_PLUGIN_NAME_DIR . '/includes/acf/add-ons/acf-options-page/acf-options-page.php');
    
    		// Remove the defualt "Options" Page from ACF as it would be included within the plugin menu or elsewhere.
    		if( ! function_exists("remove_acf_options_page")) {
    			function remove_acf_options_page() {
    				remove_menu_page('acf-options');
    			}
    			add_action('admin_menu', 'remove_acf_options_page', 99);
    		}
    	}
    
    	// WYSIWYG Editor Add-on
    	if( ! class_exists( 'acf_field_wp_wysiwyg_plugin' ) ) {
    		include_once( SET_PLUGIN_NAME_DIR . '/includes/acf/add-ons/acf-wp-wysiwyg/acf-wp_wysiwyg.php');
    	}
    	
    	// Gallery Add-on
    	if( ! class_exists( 'acf_field_gallery' ) ) {
    		include_once( SET_PLUGIN_NAME_DIR . '/includes/acf/add-ons/acf-gallery/acf-gallery.php');
    	}
    
    	// Address Field Add-on
    	if( ! class_exists( 'acf_field_address_plugin' ) ) {
    		include_once( SET_PLUGIN_NAME_DIR . '/includes/acf/add-ons/acf-field-address/acf-address.php');
    	}
    	
    }
    
  • Hi elliot,

    Here is the code for the option:

    if( function_exists('acf_add_options_sub_page') ) {
        acf_add_options_sub_page(array(
            'title' => 'Settings',
            'parent' => 'edit.php?post_type=bne_team_schedule',
            'capability' => 'edit_posts'
        ));
    }
    
    function bne_team_schedule_team_names_load_field( $field ) {
    	$field['choices'] = array();
     
    	$choices = get_field('bne_team_schedule_team_names_options', 'option');
     
    	$choices = explode("\n", $choices);
     
    	if( is_array($choices) ) {
    		foreach( $choices as $choice ) {
    			$field['choices'][$choice] = $choice;
    		}
    	}
     
        // Important: return the field
        return $field;
    }
    add_filter('acf/load_field/name=bne_team_schedule_home_team_name', 'bne_team_schedule_team_names_load_field');
    

    Attached is screenshot of the option field which is subpage of the CPT and a screen of what is outputted into the select field within ACF. Like I said, the database seems to store the correct choice but when you update the post the select field, visually, resets to the first choice in the list.

    Using ACF v4.3.0 and Options v1.2.0

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