@wordpress/hooks use to add actions/filters within multiple plugin
@wordpress/hooks use to add actions/filters within multiple plugin
@wordpress/hooks use to add actions/filters within multiple plugin
How to send data from a form created by a plugin to an external API?
Gutenberg disable the “block” tab in right sidebar
Its the woocommerce_get_shop_coupon_data filter, example code: add_filter ( ‘woocommerce_get_shop_coupon_data’, ‘mp_create_coupon’, 10, 2 ); function mp_create_coupon( $data, $code ) { // Check if the coupon has already been created in the database global $wpdb; $sql = $wpdb->prepare( “SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type=”shop_coupon” AND post_status=”publish” ORDER BY post_date DESC LIMIT 1;”, $code … Read more
This is not a bug. If you look at the comment starting at line 2100 of wp/wp-includes/comment-template.php in the wp_list_comments function, you’ll see that if the per_page argument is set and its value is different to that of the main wp_query, it’ll perform a separate comment query and display those, instead of the ones you … Read more
Hook all http requests
After banging my head against Gutenberg’s wall for a few hours, I came up with something that seems to work. It uses the useSelect and useEntityProp hooks instead of the withSelect and withDispatch HOCs. The truth is that using hooks makes the code simpler and easier to understand. /** * WordPress dependencies */ const { … Read more
You can add your JS to a file in your child theme /js/example.js, then enqueue it like this: //add_action( ‘wp_enqueue_scripts’, ‘wpdocs_theme_name_scripts’ ); function wpdocs_theme_name_scripts() { wp_enqueue_script( ‘script-name’, get_stylesheet_directory_uri() . ‘/js/example.js’, [], ‘1.0.0’, true ); } Alternatively, you can add the styles inline using this: add_action( ‘wp_enqueue_scripts’, ‘wpse_home_game’, 20 ); function wpse_home_game() { wp_register_script( ‘home-game’, false … Read more
What is the best filter where to use register_block_type?
If you look into the function comments_popup_link() you will see the following code at the end: $title = the_title_attribute( array(‘echo’ => 0 ) ); echo apply_filters( ‘comments_popup_link_attributes’, ” ); echo ‘ title=”‘ . esc_attr( sprintf( __(‘Comment on %s’), $title ) ) . ‘”>’; comments_number( $zero, $one, $more ); echo ‘</a>’; // last line Note the … Read more