What’s the Right Way to get and save remote data for a Gutenberg block?
What’s the Right Way to get and save remote data for a Gutenberg block?
What’s the Right Way to get and save remote data for a Gutenberg block?
One thing I noticed is that you’re defining EP_CATEGORIES as a string, however it’s actually a constant (defined in WordPress Core). So for example you should define your ep_mask like so (without quotes): ‘ep_mask’ => EP_CATEGORIES, You may need to flush the rewrite rules after making this change.
@mmm thanks for that code, I didnt know this filter yet. Do you know if it is also possible to add a tooltip that way? Anyway, I have a different solution to add a new button to this column, and also want to post it: add_action( ‘woocommerce_admin_order_actions_end’, ‘add_content_to_wcactions_column’ ); function add_content_to_wcactions_column() { // create some … Read more
It does, have you look at Bainternet’s solution to this question and my answer to this question? To summarise, you need to post the request to the WordPress’ admin-ajax url. If the ajax is for use on the admin-side then this url should already be available as the javascript variable ajaxurl. If this is for … Read more
I think the issue may be in your call to add_submenu_page(): add_submenu_page(‘wpsc-sales-logs’,… The first parameter needs to be a reference to your Menu Page’s “slug”, i.e. if you use ‘edit.php’ instead you’ll see that you get a menu option under the “Posts” menu page: add_submenu_page(‘edit.php’,’WPEC – Group Pricing’,’Group Pricing’, 7, ‘wp-e-commerce-group-pricing’, ‘price_options’); Here’s what it … Read more
This had me baffled for a while as well. Not exactly a solution for your problem, but this should get you on your way. add_action( ‘admin_init’, ‘my_kses_remove_filters’ ); function my_kses_remove_filters() { $current_user = wp_get_current_user(); if ( my_user_has_role( ‘administrator’, $current_user ) ) kses_remove_filters(); } function my_user_has_role( $role=””, $user = null ) { $user = $user ? … Read more
When you call add_action, you need to tell it how many parameters of the action that you want to receive. The default is just the first parameter. If you want more, then you tell it so. add_action( ‘update_option_whatever’, ‘example_callback’, 10, 2 ); The 10 is the priority (10 is default). The 2 is the number … Read more
This is why I asked for more code context. I’ll have to guess that you are checking for the front page outside of any hooked function, or inside a function that is called too early, before is_front_page() is ready. The following will work. function your_function() { $d = is_front_page(); var_dump($d); } add_action( ‘wp’, ‘your_function’ );
Is the user logged in and is allowed to delete posts of this post type? There are three checks inside the get_delete_post_link function before anything starts happening: if ( !$post = get_post( $id ) ) return; $post_type_object = get_post_type_object( $post->post_type ); if ( !$post_type_object ) return; if ( !current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) return; I’m … Read more
The code from core/columns and core/column blocks are a good example of how to achieve this behaviour. Basically we register 2 block types: Carousel and Slide. Slide block type does not appear in the inserter. Carousel block type is the root block which appears in the inserter. Instead of keeping the count of slides in … Read more