Fire an action before setting object terms during a GraphQL Post Object Mutation. One example use for this hook would be to create terms from the input that may not exist yet, so that they can be set as a relation below.

do_action( 'graphql_post_object_mutation_set_object_terms', int $post_id, array $input, WP_Post_Type $post_type_object, string $mutation_name );


  • $post_id (int): Inserted post ID
  • $input (array): The input for the mutation
  • $post_type_object (WP_Post_Type): The Post Type object for the post being mutated
  • $mutation_name (string): The name of the mutation being performed


File: wp-graphql/src/Data/PostObjectMutation.php