Remove Gutenberg Buttons Block

This added to the functions.php allows the removal of specific Gutenberg blocks. function hide_default_blocks($allowed_block) { $blocks = WP_Block_Type_Registry::get_instance()->get_all_registered(); unset($blocks[‘core/buttons’]); return array_keys($blocks); } add_filter(‘allowed_block_types_all’, ‘hide_default_blocks’); Part of the issue is that it is core/buttons and not core/button but also the method of removal was incorrect.

Add a custom code with custom link after add to cart for every product

You need to add custom meta box such as product_ext_url for product post type. Then use hook below to add your code in single product page. add_action( ‘woocommerce_after_add_to_cart_button’, ‘your_function’ ); function your_function(){ echo get_post_meta( $product_id, ‘product_ext_url’ ); } In above function you will print external url of current product after add-to-cart button. // UPDATE To … Read more

How can i add a random redirect button in wordpress? [closed]

you can use this code add_action(‘init’,’random_add_rewrite’); function random_add_rewrite() { global $wp; $wp->add_query_var(‘random’); add_rewrite_rule(‘random/?$’, ‘index.php?random=1’, ‘top’); } add_action(‘template_redirect’,’random_template’); function random_template() { if (get_query_var(‘random’) == 1) { $posts = get_posts(‘post_type=post&orderby=rand&numberposts=1’); foreach($posts as $post) { $link = get_permalink($post); } wp_redirect($link,307); exit; } } ANd then use this for random redirect <a href=”http://…..com/?random=1/” >Random Post</a>

add button to tinymce

Your method is complex… Here is simplest function to add BUTTON in TinyMCE: (insert this code in funcitons.php): add_action(‘admin_init’, function() { if (current_user_can(‘edit_posts’) && get_user_option(‘rich_editing’) == ‘true’) { add_filter(‘mce_buttons_2’, ‘register_buttonfirst’); add_filter(‘mce_external_plugins’, ‘add_pluginfirst’); } }); function register_buttonfirst($buttons) { array_push($buttons, “|”, “shortcode_button1” ); return $buttons;} function add_pluginfirst($plugin_array) {$plugin_array[‘MyPuginButtonTag’] = plugin_dir_url( __FILE__ ).’My_js_folder/1_button.php’;return $plugin_array;} add_filter( ‘tiny_mce_version’, ‘my_refresh_mceeee1’); function … Read more

File not found.