Title: Change button text &#8211; Filter hook
Last modified: June 12, 2023

---

# Change button text – Filter hook

 *  Resolved [NikkaG](https://wordpress.org/support/users/nikkag/)
 * (@nikkag)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/)
 * Hi,
 * I’m trying to change button text in admin Edit Order page ([screenshot](https://snipboard.io/u7nLeX.jpg)):
   
   from ‘PDF Invoice’ to ‘MY PDF Invoice’from ‘PDF Packing Slip’ >>> ‘MY PDF Packing
   Slip’
 * I found the filter hook ‘wpo_wcpdf_myaccount_button_text’ but I’m doing something
   wrong, can anyone help me?
   Thanks.
 *     ```wp-block-code
       add_filter( 'wpo_wcpdf_myaccount_button_text', 'my_wpo_wcpdf_myaccount_button_text', 10, 2 );
       function my_wpo_wcpdf_myaccount_button_text ( $button_text, $invoice ) {
       	$button_text_new = 'MY PDF Invoice';
       	return $button_text_new;
       }
       ```
   

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

 *  Plugin Contributor [dwpriv](https://wordpress.org/support/users/dwpriv/)
 * (@dwpriv)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16818565)
 * [@nikkag](https://wordpress.org/support/users/nikkag/) try these snippets
 *     ```wp-block-code
       add_filter( 'wpo_wcpdf_myaccount_button_text', function( $document_title, $invoice ) {	
       	return 'My PDF Invoice';
       }, 10, 2 );
   
       add_filter( 'wpo_wcpdf_myaccount_packing_slip_button', function( $document_title, $document ) {
       	return 'My PDF Packing Slip';
       }, 10, 2 );
       ```
   
 *  Thread Starter [NikkaG](https://wordpress.org/support/users/nikkag/)
 * (@nikkag)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16818727)
 * It seems they don’t work. I also tried in a demo website with Storefront theme
   and few plugins.
 *  Plugin Contributor [dwpriv](https://wordpress.org/support/users/dwpriv/)
 * (@dwpriv)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16818809)
 * [@nikkag](https://wordpress.org/support/users/nikkag/)
 * how are you adding these snippets?
 *  Thread Starter [NikkaG](https://wordpress.org/support/users/nikkag/)
 * (@nikkag)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16818901)
 * I add the snippets in functions.php
 *  Plugin Contributor [dwpriv](https://wordpress.org/support/users/dwpriv/)
 * (@dwpriv)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16822239)
 * [@nikkag](https://wordpress.org/support/users/nikkag/) I’m not having any trouble
   using the snippets. Could you show me a screenshot of how you added it to the
   functions.php fie, please? Does it also not work with a code snippet plugin?
 *  Thread Starter [NikkaG](https://wordpress.org/support/users/nikkag/)
 * (@nikkag)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16822450)
 * [This is](https://snipboard.io/0ufkyK.jpg) the code added in functions.php. I
   added it in the child theme but I tried also in master theme.
 * [This is](https://snipboard.io/U9CHFG.jpg) the code added with a code snippet
   plugin.
 *  Plugin Contributor [dwpriv](https://wordpress.org/support/users/dwpriv/)
 * (@dwpriv)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16822475)
 * [@nikkag](https://wordpress.org/support/users/nikkag/) in the top right corner
   of your screenshot, your snippet seems to be inactive. Could you hit the switch
   to activate it and see if it works?
 *  Thread Starter [NikkaG](https://wordpress.org/support/users/nikkag/)
 * (@nikkag)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16823736)
 * [@dwpriv](https://wordpress.org/support/users/dwpriv/) There was a misunderstanding,
   I want to change the text of the button in the backend, in the **admin Edit Order
   page** ([screenshot](https://snipboard.io/qeuAz6.jpg)).
   I now discovered that
   the code works, but it changes the text of the buttons in the customer My Account
   page ([screenshot](https://snipboard.io/BXzgDC.jpg)).
 *  Plugin Contributor [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * (@yordansoares)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16828536)
 * Hi [@nikkag](https://wordpress.org/support/users/nikkag/),
 * Try this code snippet:
 *     ```wp-block-code
       /**
        * PDF Invoices & Packing Slips for WooCommerce:
        * Customize the PDF Invoice title
        */
       add_filter( 'wpo_wcpdf_invoice_title', function( $title, $document ) {
           $title = 'Receipt';
           return $title;
       }, 10, 2 );
       ```
   
 *  Thread Starter [NikkaG](https://wordpress.org/support/users/nikkag/)
 * (@nikkag)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16830255)
 * Thanks!
 * And, for anybody else, ‘wpo_wcpdf_packing_slip_title’ is the related hook for
   Packing Slip button.
 *  Plugin Contributor [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * (@yordansoares)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16830457)
 * That’s right, [@nikkag](https://wordpress.org/support/users/nikkag/): We follow
   the same pattern for all our PDF documents 🙂
 * By the way, if you don’t mind and have the time, do you think you could [leave us a review](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/#new-post)?
 * Thanks in advance and all the best with your store!

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

The topic ‘Change button text – Filter hook’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices-packing-slips/assets/icon-256x256.
   png?rev=2189942)
 * [PDF Invoices & Packing Slips for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/)

## Tags

 * [hook](https://wordpress.org/support/topic-tag/hook/)

 * 11 replies
 * 3 participants
 * Last reply from: [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/change-button-text-filter-hook/#post-16830457)
 * Status: resolved