Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Why is my Toggle field not showing in Gutenberg?

You forgot to declare the attributes:

registerPlugin( 'page-layout-plugin', {
    icon: 'smiley',
    attributes: {
      'showSidebarAttribute': {'type': 'boolean', 'default': true}, // <-- and maybe others
    },
    render: ( props ) => {

You can drop the quotes of the properties, of course (they are optional), I keep them because the equivalent statement is copied over from the PHP part where the quotes are necessary:

 'showSidebarAttribute' => ['type' => 'boolean', 'default' => true],

Related Posts:

  1. Proper, exhaustive documentation for wp.editor etc
  2. Edit srcset and sizes attributes in Gutenberg image, cover and gallery – blocks
  3. How to sanitize select box values in post meta?
  4. Strategy to get post meta for use outside the loop
  5. Add colors to existing color palette without replacing it
  6. Can you filter posts by meta key with the getEntitityRecords selector?
  7. Set Expiration Date of a Post from the Frontend with wp_insert_post
  8. WP Gutenberg custom block – generate theme colors from SASS and use them in the inspector and php callback
  9. create blocks programmtically on theme activation
  10. Can I customize any WordPress parent block-based theme template files by child theme like a parent classic theme?
  11. How to support Lazy Loading Assets in a WordPress Theme?
  12. WordPress Gutenberg Theme: Structure, Hierarchy and Custom Templates
  13. Gutenberg Reusable Block as part of WordPress Theme page
  14. Is there a need for nonce with Post Metabox?
  15. Custom button block doesn’t work
  16. How to float an image in Gutenberg
  17. Gutenberg – editor-font-sizes in functions not working
  18. Metadata Query when storing data as array possible?
  19. Can’t select my block by clicking on it
  20. Which file handles the block latest posts, I want to examine excerpt handling
  21. create-guten-block in wordpress theme?
  22. What VSCode extensions are there for working with block themes? [closed]
  23. What is the “correct” way to add hooks or similar PHP behavior to a blocktheme?
  24. Not able to select width of blocks inside of cover block
  25. How to check if a WordPress core block is active in sidebar
  26. gutenberg add classes to list items
  27. How do you replace content generated by custom fields with custom blocks in Block Editor?
  28. Custom Blocks as part of a theme
  29. Wp Super Cache stops the update of a Post Meta
  30. How to wrap all titles generated by Gutenberg “Heading” block with tag
  31. How to show specific post meta?
  32. How to add InnerBlock multiple times in the same block
  33. Moving post title down the page / Removing a block from a post
  34. Running a function on post update with new post meta
  35. HTML block gutenberg templates
  36. Gutenberg theme development: how to add “headers” option under styles > colors > elements?
  37. Is it possible to set a variable for get_post_meta?
  38. Get attachment meta (I need attachment ID, unsure how to find it)
  39. How can I sort my loop based on meta data, using a form?
  40. Change default rel attributes for Image Block & Button Block
  41. Related Post Category Filter
  42. How to update mark-up of a gallery block in a custom theme?
  43. Auto focus RichText field
  44. How to create nested array attribute
  45. Show popover with url and option to open in new window
  46. How to Modify WP_Includes/blocks/latest_posts.php
  47. How to render block editor in wp-admin custom pages programmatically
  48. Social-Link block not loading html on page with custom theme
  49. How to diagnose wp-env environment problem
  50. Attribute form NumberControl doesn’t update when I update page before it lose its focus
  51. WP Gutenberg custom block – generate theme colors from SASS and use them in the inspector and php callback
  52. Posts Page shows Classic Editor interface not Gutenberg
  53. How can I include custom Gutenberg Blocks in a theme?
  54. Block validation failed for `core/pullquote` after adding theme support for editor-color-palette
  55. Is there a way to add classes to a page when using a Gutenberg reusable block as page layout?
  56. Make a custom field in admin post.php read only
  57. Change default options on attachment page
  58. Correct way to make a custom block theme responsive
  59. Multiple content areas with Gutenberg – Transparent areas mid content
  60. Insert gutenberg blocks into template
  61. After a while attachment meta data is missing “sizes” data
  62. Template for posts of category in block theme?
  63. Can’t select my block by clicking on it on apiVersion – but using blockProps
  64. How can I use pre declared blocks in a php file?
  65. Is there any filter or action hook to remove layout classes from appearing in my templates?
  66. Full site editing templates folder vs block-templates
  67. How to set the margin on an innerBlock in a block variation?
  68. Align images to the left of the content
  69. Image and font support missing in editor when deploying theme remotely
  70. When trying to run build script with gutenberg (with SVG import) – Error: Plugin name should be specified
  71. Block to show posts from same category
  72. Unwanted spacing for cover block
  73. Activate Gutenberg group block for theme
  74. How can a theme define which settings for blocks are available in the block editor?
  75. How to add multiple custom blocks in custom WordPress theme using create-block?
  76. How to create a template for a post in Query Loop block?
  77. Force post update with React
  78. WordPress 6.4.2 – can’t load editor style css using ‘after_setup_theme’ or ‘admin_init’ actions
  79. Force-update the meta variable first set using `var [ meta, setMeta = useEntityProp( ‘postType’, postType, ‘meta’ );`
  80. How to add group-row to InnerBlock template?
  81. Adding block style dependencies
  82. useBlockProps() nests wrapper with class name inside block wrapper in the editor
  83. Registering a block in “My Patterns”
  84. get_theme_mode & set_theme_mode in block editor
  85. Block editor layout not present in post editor
  86. Modify HTMl on header.php on Block Theme like Twenty Twenty Three?
  87. Disable interactivity for core navigation
  88. Full Site Editing, Block Theme, Gutenberg, Site Editor
  89. FSE Change Post Template to Something Other Than a List
  90. how to combine wordpress and front framework
  91. Correct way of implementing complex navigation in Gutenberg
  92. How do I access the current post object within a block theme template or pattern?
  93. Menu items description? Custom Walker for wp_nav_menu()
  94. How to define and link full path to css located at a random folder on header.php
  95. Sizing screenshot.png without losing aspect ratio
  96. Software for WordPress Theme and Plugin Development? [closed]
  97. When to use is_home() vs is_front_page()?
  98. What is the preferred way to add custom javascript files to the site?
  99. Get the blog page URL set in Options
  100. How to create .pot files with POedit?
Categories theme-development Tags block-editor, post-meta, react, theme-development
How to create multiple urls for a same page contents in wordpress
selecting custom post types and taxonomies for hub page listing blocks

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress