Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickgilmour/0bf32f8c9bc5070abfab to your computer and use it in GitHub Desktop.
Save patrickgilmour/0bf32f8c9bc5070abfab to your computer and use it in GitHub Desktop.
Filter the Title of a WooCommerce Product on the Single Product Page
<?php
/**
* Rename/Filter the Title of a WooCommerce Product on the Single Product Page
*
*/
add_filter('the_title', 'xcsn_single_product_page_title', 10, 2);
function xcsn_single_product_page_title($title, $id) {
if( ( is_product() && in_the_loop() ) ) {
//Logic for changing the WooCommerce Product Title on a Single Product page goes here
return $title;
}
//Return the normal Title if conditions aren't met
return $title;
}
@BonBonSlick
Copy link

it is changing all titles ....

@zaderade
Copy link

zaderade commented Nov 4, 2018

Works for me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment