Cannot redeclare `get_post_type_graphql_fields()` previously declared
renatonascalves opened this issue · 0 comments
renatonascalves commented
I noticed this bug while adding unit tests in a plugin.
PHP Fatal error: Cannot redeclare get_post_type_graphql_fields() (previously declared in /var/www/project/wp-content/plugins/add-wpgraphql-seo/wp-graphql-yoast-seo.php:748) in /var/www/project/wp-content/plugins/add-wpgraphql-seo/wp-graphql-yoast-seo.php on line 748
Fatal error: Cannot redeclare get_post_type_graphql_fields() (previously declared in /var/www/project/wp-content/plugins/add-wpgraphql-seo/wp-graphql-yoast-seo.php:748) in /var/www/project/wp-content/plugins/add-wpgraphql-seo/wp-graphql-yoast-seo.php on line 748
The issue seems to be because this function is being instantiated inside the graphql_register_types
hook action which can be run multiple times.
wp-graphql-yoast-seo/wp-graphql-yoast-seo.php
Line 748 in 278d751