@binarywc Thank you for the suggestion. I did try using ACF to create the fields in the post types, but WPGraphQL doesn’t recognized them. I’m not sure if ACF causes the field to be names something else. I might try to add them again and use @bcworkz var_dump idea.
@bcworkz Thank you for your suggestion. I tried the var_dump() but it doesn’t show all of the fields that are bing registered with the post type. I used this example from wp-mix
// View all WP Post variables
function wpmix_display_globals($content) {
return $content . var_export($GLOBALS['post'], TRUE);
}
add_filter('the_content', 'wpmix_display_globals');
I’m curious though because you said they are an array and the items in the initial array show with the var dump, but not the additional items including the ones I need to add. Here is is the code from the plugin that I have modified. What are the fields considered after the array?
register_post_type( sanitize_title( substr( strtolower( $achievement_name_singular ), 0, 20 ) ), array(
'labels' => array(
'name' => $achievement_name_plural,
'singular_name' => $achievement_name_singular,
'add_new' => __( 'Add New', 'badgeos' ),
'add_new_item' => sprintf( __( 'Add New %s', 'badgeos' ), $achievement_name_singular ),
'edit_item' => sprintf( __( 'Edit %s', 'badgeos' ), $achievement_name_singular ),
'new_item' => sprintf( __( 'New %s', 'badgeos' ), $achievement_name_singular ),
'all_items' => $achievement_name_plural,
'view_item' => sprintf( __( 'View %s', 'badgeos' ), $achievement_name_singular ),
'search_items' => sprintf( __( 'Search %s', 'badgeos' ), $achievement_name_plural ),
'not_found' => sprintf( __( 'No %s found', 'badgeos' ), strtolower( $achievement_name_plural ) ),
'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'badgeos' ), strtolower( $achievement_name_plural ) ),
'parent_item_colon' => '',
'menu_name' => $achievement_name_plural,
),
'public' => true,
'publicly_queryable' => true,
'show_ui' => current_user_can( badgeos_get_manager_capability() ),
'show_in_menu' => $show_in_menu,
'show_in_graphql' => true,
'graphql_single_name' => str_replace(' ','', $achievement_name_singular),
'graphql_plural_name' => str_replace(' ','', $achievement_name_plural),
'query_var' => true,
'rewrite' => array( 'slug' => sanitize_title( strtolower( $achievement_name_singular ) ) ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'page-attributes' )
) );
-
This reply was modified 4 years, 5 months ago by decaren. Reason: fix code formatting