What is the best filter where to use register_block_type?
What is the best filter where to use register_block_type?
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
This function will clear WP Super Cache upon saving of ACF Options page. Enjoy! <?php /* Additional Function to prune the Cache if $post_id is ‘0’ or ‘options’ */ function f711_clear_custom_cache($post_id) { // just execute if the $post_id has either of these Values. Skip on Autosave if ( ( $post_id == 0 || $post_id == … Read more
I have not tested this but based on your question, this should get you on track: <?php $id = 4; // The Page or post ID $page_data = get_post( $id ); $title = $page_data->post_title; $content = $page_data->post_content; $excerpt = substr($content, 0, 155); $featured_image = wp_get_attachment_url( get_post_thumbnail_id($id, ‘thumbnail’) ); ?> <div class=”post”> <h1><?php echo $title; ?></h1> … Read more
storefront_single_post hook pertains only to single posts and not products although products are considered posts of type ‘product’ This is the hook you need: add_action( ‘woocommerce_single_product_summary’, ‘storefront_post_header_categories’, 6 ); function storefront_post_header_categories() { echo “code to display categories here”; } You will find it in plugins/woocommerce/content-single-product.php: /** * woocommerce_single_product_summary hook * * @hooked woocommerce_template_single_title – 5 … Read more
Seems that when you modify the existing block’s HTML, then it is no longer being validated. Instead, you might try to create your own block. Look here is a good approach and here too.
Inside wp_delete_post() there is the following code, /** * Filters whether a post deletion should take place. * * @since 4.4.0 * * @param bool|null $delete Whether to go forward with deletion. * @param WP_Post $post Post object. * @param bool $force_delete Whether to bypass the trash. */ $check = apply_filters( ‘pre_delete_post’, null, $post, $force_delete … Read more
I’d guess this code is being run directly from your plugin’s functions.php, meaning that you’re evaluating is_front_page() and is_archive() as you load the plugin. That’s too early – that’s before enough state has been initialised to know which page you’re on. To fix this, you either need to: move the logic into your say_hello functions, … Read more
There are hooks specifically for this, actually. The codex has a pretty good overview. Essentially every time WordPress saves a post (which it does through wp_insert_post) or alters the status of the post, it calls wp_transition_post_status which looks like this: <?php // in wp-includes/post.php function wp_transition_post_status($new_status, $old_status, $post) { do_action(‘transition_post_status’, $new_status, $old_status, $post); do_action(“{$old_status}_to_{$new_status}”, $post); … Read more
WordPress uses the PHPMailer class for sending mail. Before calling wp_mail, you can manipulate the $phpmailer object using the phpmailer_init filter. //Place this inside of your form callback before wp_mail() add_filter(‘phpmailer_init’, ‘foobar_phpmailer’, 99999, 1); function foobar_phpmailer(&$phpmailer){ //Manipulate the phpmailer object here }