Get Menu Items from REST API (React)

getMenu() fetches data from the GET /wp/v2/menus/<id> endpoint, whereas getMenuItem() fetches data from the GET /wp/v2/menu-items/<id> endpoint, but they have the same usage syntax, where you just need to pass the ID of a menu or menu item. As for getMenuItems() and another function you can use — getMenus(), the endpoints are GET /wp/v2/menu-items (for … Read more

Using useSelect creates “minified React error”

If you check the URL given with the error message, you will see the full text as: Rendered more hooks than during the previous render. Inspecting the code, I see two uses of hooks: export default function Edit() { const allCPTposts = useSelect(select => { // ^ first hook use return select(“core”).getEntityRecords(“postType”, “post”, {per_page: -1}) … Read more

How to change this WP logo and posts url in block editor?

You can change the logo in the block editor or site editor using the SlotFill system. Have a look at the this example code taken from https://developer.wordpress.org/block-editor/reference-guides/slotfills/main-dashboard-button/ import { registerPlugin } from ‘@wordpress/plugins’; import { __experimentalMainDashboardButton as MainDashboardButton } from ‘@wordpress/edit-post’; const MainDashboardButtonTest = () => ( <MainDashboardButton> Custom main dashboard button content </MainDashboardButton> ); … Read more

Unable to see the attributes for the custom block created

Attributes just define a “schema” of sorts which informs WordPress which persistent data is associated with a block, and how WordPress should parse it from the block’s saved markup/block grammar. WordPress makes no assumptions about if or how a UI should be constructed to expose attributes to the end-user – you must construct the UI … Read more

Pullquote Block Styles disappeared?

The solid colour pullquote style had been deprecated and removed in 2021, and was removed in favor of more comprehensive options based on block style options: Given that we can now achieve border and background variations using block supports, we’re removing the existing styles and adding a textAlign attribute to compensate. https://github.com/WordPress/gutenberg/pull/30951 If you really … Read more

wp-scripts start build hangs

Nothing is hanging. It’s just waiting for a change so that it can automatically build again. That’s what start does. If you just want to run a build once use build. The warnings in your second example are self explanatory: You’re using a font asset that is very large and exceeds the recommended maximum size. … Read more