I would like to add a new column to the Attributes table on the Attributes add / edit page within Woocommerce / WordPress admin, using the WordPress / PHP add_filter command.
As a reference, to add columns in WordPress admin to the Woocommerce All Products add / adit table, the following filter works:
add_filter( 'manage_edit-product_columns', 'add_product_column', 10, 1 )
The All Products page is:
wp-admin/edit.php?post_type=product
and I see the add_filter follows the pattern:
manage_edit-{POST_TYPE}_columns
I cannot find or work out what the filter should be to do the same on the Woocommerce Attributes add / edit page. The page URL for that is:
wp-admin/edit.php?post_type=product&page=product_attributes
I’ve experimented with various combinations using the working filter for the All Products page, but I am not clear how to use add_filter when URL contains both Post Type and Page.
I hope I have explained it clearly. I have searched a lot for the answer, both here and in Google, so if there is a duplicate, I genuinely have not seen anything close to what I’m looking for.
Thanks in advance!
2
Answers
I don’t think it is possible, i had a quick peek at the sourcecode of woocommerce. The function that outputs the list you are talking about is located on line 296 of includes/admin/class-wc-admin-attributes.php and is outputting a static column layout.
https://github.com/woocommerce/woocommerce/blob/aa89afcf957beb6a387ad7d5d36fd7d95b3a353b/includes/admin/class-wc-admin-attributes.php
You could, but i don’t recommend it, abuse the get text filter for this
something like this
It is only possible to either put the column in front of or after the "Order By" column in this way and I don’t know what information is available in the code for using in the output, as this is a very hacky way to do thing I don’t recommend using this method