Title: method_exists()
Last modified: April 2, 2024

---

# method_exists()

 *  Resolved [Robin](https://wordpress.org/support/users/robinrsa/)
 * (@robinrsa)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/method_exists/)
 * Hi there
 * I get an error with multiple code snippets when using the plugin.
 * > method_exists(): Argument #1 ($object_or_class) must be of type object|string,
   > array given
 * An example code snippet being used is:
 *     ```wp-block-code
       function search_above_shop_loop() {
       	$term = get_queried_object();
       	$taxonomy = isset($term->taxonomy) ? $term->taxonomy : null;
       	if( $taxonomy && ! in_array( $taxonomy, array( 'product_cat', 'product_brand' ) ) ){
       		echo '<div class="shop_search_bar">'.do_shortcode('[wd_asp id=1]').'</div>';
       	}
       }
       add_action( 'woocommerce_before_shop_loop', 'search_above_shop_loop', 10 );
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Mircea Sandu](https://wordpress.org/support/users/gripgrip/)
 * (@gripgrip)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/method_exists/#post-17544864)
 * Hi [@robinrsa](https://wordpress.org/support/users/robinrsa/),
 * Since it seems like the error is not coming directly from the snippet you shared,
   the error is likely coming from one of the other snippets that are active on 
   your site that is causing a side-effect.
 * I recommend doing a search for “method_exists” using the search in the list of
   snippets to narrow down the search and then make sure that the variable you are
   using for the method_exists call is actually an object or class.
 * You can also try to deactivate the other active snippets one by one until the
   error is no longer showing up if you don’t have a large number of active snippets.
 *  Thread Starter [Robin](https://wordpress.org/support/users/robinrsa/)
 * (@robinrsa)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/method_exists/#post-17544872)
 * Thank you [@gripgrip](https://wordpress.org/support/users/gripgrip/) I managed
   to find the issue based on your steps.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘method_exists()’ is closed to new replies.

 * ![](https://ps.w.org/insert-headers-and-footers/assets/icon-256x256.png?rev=2758516)
 * [WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager](https://wordpress.org/plugins/insert-headers-and-footers/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-headers-and-footers/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-headers-and-footers/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-headers-and-footers/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Robin](https://wordpress.org/support/users/robinrsa/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/method_exists/#post-17544872)
 * Status: resolved