Title: PHP Error
Last modified: May 31, 2022

---

# PHP Error

 *  [Tofandel](https://wordpress.org/support/users/tofandel/)
 * (@tofandel)
 * [4 years ago](https://wordpress.org/support/topic/php-error-529/)
 * In `shopping-feed/src/Product` there is a mistake in the code which makes the
   editing of products impossible when Yoast SEO is enabled
 *     ```
       	private function set_category() {
   
       		$return = '';
       		$term   = ShoppingFeedHelper::wc_category_taxonomy();
   
       		if ( class_exists( 'WPSEO_Primary_Term' ) ) {
       			// Show Primary category by Yoast if it is enabled & set
       			$wpseo_primary_term = new WPSEO_Primary_Term( $term, $this->id );
       ```
   
 * The problem is that this file is namespaced and the `WPSEO_Primary_Term` is not
   thus it’s looking for it in the local namespace (and not the global one) and 
   obviously it doesn’t find it
 * `PHP Fatal error: Uncaught Error: Class 'ShoppingFeed\\ShoppingFeedWC\\Products\\
   WPSEO_Primary_Term' not found in ...`
 * It needs a slash in front:
 *     ```
       	private function set_category() {
   
       		$return = '';
       		$term   = ShoppingFeedHelper::wc_category_taxonomy();
   
       		if ( class_exists( '\WPSEO_Primary_Term' ) ) {
       			// Show Primary category by Yoast if it is enabled & set
       			$wpseo_primary_term = new \WPSEO_Primary_Term( $term, $this->id );
       ```
   
 * Or a `use \WPSEO_Primary_Term;` at the top of the file

The topic ‘PHP Error’ is closed to new replies.

 * ![](https://ps.w.org/shopping-feed/assets/icon-256x256.png?rev=2422339)
 * [ShoppingFeed](https://wordpress.org/plugins/shopping-feed/)
 * [Support Threads](https://wordpress.org/support/plugin/shopping-feed/)
 * [Active Topics](https://wordpress.org/support/plugin/shopping-feed/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shopping-feed/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shopping-feed/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Tofandel](https://wordpress.org/support/users/tofandel/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/php-error-529/)
 * Status: not resolved