Title: PHP code error?
Last modified: June 9, 2022

---

# PHP code error?

 *  [martini0](https://wordpress.org/support/users/martini0/)
 * (@martini0)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/php-code-error-3/)
 * There appears to be an error in the following php code. Any idea?
 *     ```
       /**
       * @snippet Remove "Default Sorting" Dropdown @ WooCommerce Shop & Archive Pages
       */
       add_action( 'init', 'njengah_remove_default_sorting_storefront' );
   
       function njengah _remove_default_sorting_storefront() {
          remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
          remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
       }
       ```
   
 * Error:
    syntax error, unexpected ‘_remove_default_sorting_storef’ (T_STRING),
   expecting ‘(‘
    -  This topic was modified 3 years, 10 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).

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

 *  [Jacob Peattie](https://wordpress.org/support/users/jakept/)
 * (@jakept)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/php-code-error-3/#post-15722845)
 * Here:
 *     ```
       function njengah _remove_default_sorting_storefront()
       ```
   
 * There’s a space between `njengah` and `_remove_default_sorting_storefront` that
   shouldn’t be there.
 *  [Weboccult Technologies Pvt Ltd](https://wordpress.org/support/users/weboccults/)
 * (@weboccults)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/php-code-error-3/#post-15722857)
 * [@martini0](https://wordpress.org/support/users/martini0/) after removing the
   space in the function name, it is working fine. So can you please try after removing
   that?
 *     ```
       /**
       * @snippet Remove "Default Sorting" Dropdown @ WooCommerce Shop & Archive Pages
       */
       add_action( 'init', 'njengah_remove_default_sorting_storefront' );
   
       function njengah_remove_default_sorting_storefront() {
          remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
          remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
       }
       ```
   
    -  This reply was modified 3 years, 10 months ago by [Weboccult Technologies Pvt Ltd](https://wordpress.org/support/users/weboccults/).
 *  Thread Starter [martini0](https://wordpress.org/support/users/martini0/)
 * (@martini0)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/php-code-error-3/#post-15722864)
 * Got it, that was it indeed. However, the code is not working. I use Avada. I 
   want to remove all woocommerce sorting via PHP. Not via CSS.
 * [https://avada.io/woocommerce/docs/remove-product-sorting.html](https://avada.io/woocommerce/docs/remove-product-sorting.html)

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

The topic ‘PHP code error?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [martini0](https://wordpress.org/support/users/martini0/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/php-code-error-3/#post-15722864)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
