Last active
July 11, 2019 03:57
-
-
Save jake-101/5c930e5af129ecd9f003cac9c7f13273 to your computer and use it in GitHub Desktop.
Add ACF field to WPGraphQL WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'graphql_register_types', function() { | |
register_graphql_field( 'Product', 'tech_specs', [ | |
'type' => 'String', | |
'description' => __( 'tech specs', 'wp-graphql' ), | |
'resolve' => function( $post ) { | |
$id = $post->ID; | |
$specs = get_field( "tech_specs",$id); | |
$enc = strip_tags($specs,"<p>,<br>,<ul>,<li>"); | |
return $enc; | |
} | |
] ); | |
} ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment