Questions tagged [hook-wordpress]

36 questions
8
votes
5 answers

How to get post author name in WordPress?

In WordPress I need to fetch name of author who created post using author_id. How can I find author_name ?
Rakhi Prajapati
  • 582
  • 1
  • 7
  • 21
8
votes
1 answer

Adding "Sale" product category to products that are on sale in Woocommerce

As part of a WooCommerce site I want to have a sale page that lists sale items (with pagination and filtering). I think the best way to do this is to have a 'Sale' category that is added automatically to any posts that are part of the sale (as…
4
votes
1 answer

Run a function on custom button click in woocommerce admin order page

Based on "Add a button on top of admin orders list in woocommerce" answer code, I was able to add a custom button on woocommerce admin orders list. Here is that code (lightly customized): add_action( 'manage_posts_extra_tablenav',…
Vincenzo Di Gaetano
  • 2,842
  • 2
  • 6
  • 21
4
votes
3 answers

Check if cart is NOT empty in Woocommerce 3

I can' figure this out, how to check if cart is empty. What am I doing wrong? My code: add_action( 'wp_footer', 'redirecionar' ); function redirecionar(){ global $woocommerce; if ( is_page('carrinho-de-compras') and…
user5483053
3
votes
1 answer

Exclude multiple custom taxonomies terms from Wordpress search

I am excluding from Wordpress search results any posts or custom posts with custom taxonomies set to specific terms. I want to be able to add more taxonomies and terms simply (like in an array) without having the duplicate the function, and ensure…
3
votes
2 answers

Adding a hook to "Place order" button in woocommerce

When the user gets to the checkout, there is a button , the "Place order" button at the bottom of the form. I have been trying to add a hook to this button in woocommerce, but I don't seem to find the correct one, I have tried…
MariaZ
  • 1,505
  • 9
  • 23
  • 38
2
votes
0 answers

How to call Woocommerce Class function from functions.php?

Woocommerce has a built in class (WC_Structured_Data) to genrate strucured data into product pages. This class or function is tied to woocommerce_single_product_summary action but it is missing from my temaplte file for some reason. I am trying to…
2
votes
1 answer

When exactly woocommerce/wordpress hooks are called?

I know there are hundreds of action hooks available in Wordpress and in Woocommerce plugin, but what is most confusing to me is: when exactly they are invoked? For some of the hooks there are some information available in the internet, but for many…
2
votes
1 answer

Which available hook after products bulk save is completed in Woocommerce

I have customized the bulk edit functionality using add_action('woocommerce_product_bulk_edit_start', function () { // ... }, 10, 0); add_action('woocommerce_product_bulk_edit_save', function ($product) { // ... }, 10, 1); I would like to…
mike.bronner
  • 1,115
  • 1
  • 15
  • 34
2
votes
1 answer

Hooks and their hooked functions execution queue in Wordpress and Woocommerce

I am new to Wordpress/WooCommerce and PHP, although I have experience in other web platforms and languages. I have searched, but have not found the answer to my question which is... Are hooks that are created by the "add_action" "added" to the list…
2
votes
1 answer

Reduce product long description in Woocommerce

I have found the following code from this answer thread, but it only applied under the product title. So how can apply to the detailed description of the product. add_action( 'woocommerce_after_shop_loop_item_title', 'shorten_product_excerpt', 35…
Duc Phuli
  • 179
  • 1
  • 2
  • 12
2
votes
1 answer

Create a Woocommerce product when post is created

I am using Woocommerce on my WordPress site. and I am Selling Various items on my site. What I want is that every time I create a small post about a particular item.it also creates a Woocommerce product page with the one item available to be sold. …
benji8
  • 119
  • 11
2
votes
1 answer

How to display all WordPress user without admin list with user info

I want to display all my users info in my index.php ie : User Name / Full Name / Social Links / Profile Picture etc etc. Can any one tell me please how to display all wordpress users list in index.php without admin? Code:
gul rathod
  • 121
  • 11
1
vote
2 answers

Change some strings and substrings in Woocommerce using gettext hook

The code I used over the years (example below) hasn't worked for awhile. Tried some other code posted on here, but no joy. It seems WC has changed how to filter/translate and each text changed needs to be separate. Is that correct? Originally had 11…
Charly
  • 25
  • 1
  • 8
1
vote
1 answer

Set a default value for "number of items per page" in WooCommerce admin product list

WordPress allows each user to set his own value for "Number of items per page" in the Admin Products Page /wp-admin/edit.php?post_type=product. I'm looking for a code to set the same value for "Number of items per page" for all users regardless of…
JPashs
  • 11,104
  • 10
  • 28
  • 43
1
2 3