I’m running both the latest version of both this plugin and WordPress, Twenty Nineteen theme, and the following code below:
/**
* Create Post Type
*
* @return void
*/
function prefix_cpt_init() {
// Slides Custom Post Type
register_post_type( 'cpt_slides', array(
'labels' => array(
'name' => __( 'Slides' ),
'singular_name' => __( 'Slide' ),
'all_items' => __( 'View Slides' ),
'add_new' => __( 'New Slide' ),
'add_new_item' => __( 'New Slide' ),
'edit_item' => __( 'Edit Slide' ),
'view_item' => __( 'View Slide' ),
'search_items' => __( 'Search Slides' ),
'no_found' => __( 'No Slides Found' ),
'not_found_in_trash' => __( 'No Slides in Trash' ),
'featured_image' => __( 'Slide Image' ),
'set_featured_image' => __( 'Set slide image' ),
'remove_featured_image' => __( 'Remove slide image' ),
'use_featured_image' => __( 'Use as slide image' ),
),
'public' => false,
'publicly_queryable'=> false,
'exclude_from_search'=> true,
'show_ui' => true,
'query_var' => false,
'show_in_nav_menus' => false,
'capability_type' => 'page',
'hierarchical' => false,
'menu_position' => 3,
'menu_icon' => 'dashicons-format-gallery',
'supports' => array( 'title', 'thumbnail' )
) );
}
add_action( 'init', 'prefix_cpt_init' );
All plugins are disabled except Groups. I’ve gone with a re-installation of WordPress too. I’m open to suggestions on what else it could be.
– – – – – – – – –
Editing plugin files to try and debug the issue:
lib\views\class-groups-uie.php LN 100 if I console log jQuery and selectize, it is telling me that selectize is undefined at this point.
$call_output .= 'console.log( typeof selectize );';
– – – – – – – – –
lib\views\class-groups-uie.php LN 70
If I throw in a quick test:
error_log( ( ! wp_script_is( 'selectize' ) ) ? 'true' : 'false' );
I get 1 false then a ton of trues but if I inspect the source ( not view source ) and search for selectize.min.js it’s nowhere to be found. If I enqueue these scripts normally it works as expected:
add_action( 'admin_enqueue_scripts', function() {
global $groups_version;
if ( !wp_script_is( 'selectize' ) ) {
wp_enqueue_script( 'selectize', GROUPS_PLUGIN_URL . 'js/selectize/selectize.min.js', array( 'jquery' ), $groups_version, false );
}
if ( !wp_style_is( 'selectize' ) ) {
wp_enqueue_style( 'selectize', GROUPS_PLUGIN_URL . 'css/selectize/selectize.bootstrap2.css', array(), $groups_version );
}
if ( !wp_style_is( 'groups-uie' ) ) {
wp_enqueue_style( 'groups-uie', GROUPS_PLUGIN_URL . 'css/groups-uie.css', array(), $groups_version );
}
} );
@proaktion
My guess would be that the scripts and styles are trying to be enqueued whenever the media frame opens but since the page is already loaded and the frame populates dynamically the scripts cannot be included. I imagine if I had a groups metabox on the page this would load just fine since the selectize script has already loaded but since I do not have a groups metabox on this specific post type, no selectize has been enqueued and thus the issue occurs. Anywhere the media module is needs to have selectize whether or not the Groups metabox is present. A simple solution would be to load selectize on admin if a selectize script isn’t already present.
Hopefully a solution for this issue can be pushed in the near future.
-
This reply was modified 6 years, 11 months ago by
Howdy_McGee.
-
This reply was modified 6 years, 11 months ago by
Howdy_McGee.