Gutenberg add a custom metabox to default blocks

Using filters we can modify the props and attributes of blocks. First we extend the attributes to include the new attribute: const { addFilter } = wp.hooks; // Register/add the new attribute. const addExtraAttribute = props => { const attributes = { …props.attributes, extra_attribute: { type: “string”, default: “default_value” } }; return { …props, attributes … Read more

How can I change the admin search posts fields?

It is possible, but you’ll have to play a little bit with the actual query. As always, the furious posts_clauses filter comes to action: function wpse_alter_posts_search( $pieces ) { global $wpdb; // Make the input save $search_string = like_escape( $_GET[‘s’] ); // Your new WHERE clause $where = $wpdb->prepare( “$wpdb->postmeta.%s LIKE %s”, ‘YOUR_COLUMN’, // Should … Read more

How to add tab which is visible only in admin side of product in woocommerce? [closed]

I have worked on your issue and found a solution after some Google. Note: Add the below mentioned code to theme’s functions.php or any plugin’s file. Code: This filter function will add a custom tab to the Products Data metabox <?php add_filter( ‘woocommerce_product_data_tabs’, ‘add_my_custom_product_data_tab’ , 99 , 1 ); function add_my_custom_product_data_tab( $product_data_tabs ) { $product_data_tabs[‘my-custom-tab’] … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)