I am concerned the implementation is incorrect
If you just wanted to know whether you have correctly used useSelect
, then yes, you have — and I would also return the same object as returned by your callback.
However, instead of const imageSizes = useSelect( ... )
, I’d just do const { image, imageSizes } = useSelect( ... )
, i.e. unpack the properties, and then I would not need the const { image } = imageSizes;
and I also would just use imageSizes
instead of imageSizes.imageSizes
.
But that’s just my personal preference, and one reason is because unpacking would make the code less.
Related Posts:
- Error : “Updating failed: The response is not a valid JSON response” with custom shortcode
- Are block templates incompatible with serialize_blocks?
- How to access noticeOperations from withNotices
- WP Gutenberg Blocks – How to limit first/root blocks
- How to get boolean value from register_meta properly?
- How to only load css for used blocks on frontend
- Invalid hook call on save, not edit when using swiper slider
- Gutenberg blocks error: Each child in a list should have a unique “key” prop
- Pass custom props to
- Gutenberg text field validation
- Why isn’t custom sidebar panel not showing up in the Gutenberg Editor?
- Remove Gutenberg Buttons Block
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- What process do you use for WordPress development? [closed]
- What is the advantage of using wp_mail?
- Should Plugin Folders Include a Blank index.php File?
- Should I create a theme or a plugin?
- Where do I start from
- WP 3.3 Tooltips API?
- wp_remote_get doesn’t work with secure connections https?
- Authoritative answer on which boots first – Plugins or Themes?
- How to Add Font Awesome Icons to WordPress Menus?
- Custom theme sufficient or custom plugin neccessary for this feature set?
- Create Element From Dynamic HTML String [closed]
- How to create custom home page via plugin?
- How to debug WordPress correctly?
- Featured Image not showing in admin
- How to Parse an Array of Elements in Gutenberg Block
- Whats the difference between blog_info(‘stylesheet_url’) difference get_stylesheet_uri()
- Paging on a future post loop?
- Gutenberg – What is the best way to save/update post meta?
- How to check if a stylesheet is already loaded?
- Problem with is_active_sidebar?
- How to create multiple Gutenberg blocks in one plugin
- How to get color name in PanelColorSettings in custom Gutenberg block?
- Change template dynamically
- How to use get_theme_mod in gutenberg editor wordpress?
- Get Current Menu Location inside Nav_Walker
- Howto: Use Custom Post Types as Submenu Items in Admin
- Is there an additional block.json property to set to get an InnerBlocks child to respect the “supports” property?
- How to setAttributes in Gutenberg block?
- How to prevent UNDO on guternberg block editor
- How to override gutenberg paragraph block edit property
- What’s the right way to instantiate new blocks and/or the plugin itself in toto when using wppb architecture?
- Creating a custom Gutenberg block with columns
- How can I get the selected string when using a toolbar button in Gutenberg?
- How to limit number of number of categories displayed by categories widget
- How to hide or rename “X” and “x-child” references in website source?
- How to control an elements classes from multiple Gutenberg sidebar controls?
- Plugin is not generating title tags on any pages or posts
- Is it necessary to do validation again when retrieving data from database?
- Update Data parameter of a wp_localize_script() call
- get_the_tags with separator control?
- Add child pages to submenu automatically
- Why in this archive page that call query_posts() function show only the last 10 posts?
- PHP File_exist() not working – Checking if File Exist in WordPress Theme Directory
- Why would you use esc_attr() on internal functions?
- How to save post meta as an array in Gutenberg?
- Developing the save function in Gutenberg blocks
- WordPress Gutenberg InnerBlocks renderAppender not showing with template
- modify show UI of a registered taxonomy
- Using HTML links within translatable string
- How to get terms for taxonomy
- How to remove/replace current page template?
- WordPress Page Reload Takes forever during theme development
- Adjust query on single
- Using password protection to load different page elements?
- Anyone using unzip_file successfully? It uploads the zip but doesn’t extract it!
- How to use attributes in competent of Gutenberg
- Getting incorrect filepath inside custom block front-end output using @wordpress/create-block tutorial
- Trigger function on Remove block or add new block in Gutenberg JavaScript
- WPGut – Updating failed and shortcode?
- Rerender core Templates with with ToggleControl but it doesnt recognize block type
- Gutenberg – Call google map render function in save after DOM has been rendered
- HTMLCollection not counting right in editor? / for loop not working on elements in DOM
- How to use setAttributes outside of the edit function return
- How do I add filter with woocommerce categories?
- Where do I hook to have the server do something in PHP on block attribute change?
- How can we stop showing short code in create or edit post section
- Error Connecting to Database WHEN Installing WordPress on XAMPP [Tried All the Usual Stuff] (Pics Included)
- How can I measure CPU and RAM used by my theme or plugin
- How to get access the ID of all posts of custom post type in Gutenberg editor
- set a custom post type to a taxonomy term programmatically in metabox
- My enqueue admin style function doesn’t work because of ?=ver
- Can i prevent the effect of the_title filter on the dashboard’s posts/pages titles?
- How to embed or integrated a custom WordPress Widget into the theme?
- To remove rendering of menus and header, plugin or theme?
- How can I add recent posts to menu like mashable
- Is there a general way to get a themes primary colour?
- How to Register/Link to .js Files in WordPress Dynamicaly in Header.php
- Best Way to Inventory the Media Library of a 200+ Multisite Installation?
- Loading jQuery library from WordPress admin
- Using tag or inline style attribute?
- how to insert content into wp_head after loop_end
- How can i add insertion point between inner blocks in my custom block like core blocks
- How to get the value entered in the input field in wordpres
- Help interpreting @wordpress/create-block-tutorial-template usage error
- How can I add a custom button to the post editor?
- Block Development: hamburger module throwing error in save function
- Adding a navigation with wp_nav_menu() to a custom block in the site editor