acf-medium-editor icon indicating copy to clipboard operation
acf-medium-editor copied to clipboard

wp-graphql support

Open stephanedemotte opened this issue 3 years ago • 0 comments

If someone is looking to output thefield with wp-graphql or if the author would support wp-graphql, here a fix

add_filter('wpgraphql_acf_supported_fields', function ($supported_fields) {
  array_push($supported_fields, 'medium_editor');
  return $supported_fields;
});

add_filter('wpgraphql_acf_register_graphql_field', function($field_config, $type_name, $field_name, $config) {
  $acf_field = isset( $config['acf_field'] ) ? $config['acf_field'] : null;
  $acf_type  = isset( $acf_field['type'] ) ? $acf_field['type'] : null;
  if($acf_type == 'medium_editor')
    $field_config['type'] = 'String';
  return $field_config;
}, 10, 4);

Thanks for this plugin !

stephanedemotte avatar Oct 27 '21 19:10 stephanedemotte