• Hi, I just added the php code with code-snippets.
    After I clicked to save, it says “HTTP ERROR 500″….!!!!!!!!
    I wanted to rename “tag” WooCommerce Taxonomy
    and added

    /**
    * @snippet Rename “Tags” into “Brands” @ Single Product Page – WooCommerce
    * @how-to Watch tutorial @ https://businessbloomer.com/?p=19055
    * @sourcecode https://businessbloomer.com/?p=21598
    * @author Rodolfo Melogli
    * @compatible WC 3.4.3
    */

    add_filter(‘gettext’, ‘bbloomer_translate_tag_taxonomy’);
    add_filter( ‘ngettext’, ‘bbloomer_translate_tag_taxonomy’ );

    function bbloomer_translate_tag_taxonomy($translated) {

    if ( is_product() ) {
    // This will only trigger on the single product page
    $translated = str_ireplace(‘tag’, ‘brand’, $translated);
    }

    return $translated;
    }

    this source.

    Now I made the plug-in disabled, but I need that plug-in definitely…
    How can I approach the DB for that plug-in or delete the last changing…?
    Please… Save my website ….omg
    Unfortunately, I don’t know how to approach the DB cause we didn’t use the FTP or something..

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Hi,

    You can enable safe mode, which will allow you to login and deactivate the snippet causing the error.

    As to the snippet – the reason why it is failing is because you should never call complex functions such as is_product() or is_singular() inside a gettext filter. Often these functions will invoke gettext methods themselves, which will create a recursive loop.

    Additionally, is_product() will also fail much of the time seeing as it is a template tag and can only be called during the loop.

    Here’s a better version of that snippet (keep in mind that I still discourage you from using getttext filters at all):

    add_action( 'template_redirect', function () {
    	if ( is_singular( array( 'product' ) ) ) {
    		add_filter( 'gettext', 'bbloomer_translate_tag_taxonomy' );
    		add_filter( 'ngettext', 'bbloomer_translate_tag_taxonomy' );
    	}
    } );
    
    function bbloomer_translate_tag_taxonomy( $translated ) {
    	return str_ireplace('tag', 'brand', $translated );
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Help! my site broke! HTTP ERROR 500’ is closed to new replies.