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

WP Rest API feature image breaking react component

Resolved! If no feature image exists, then _embedded[‘wp:featuredmedia’] is not used. To resolve, the prop value needs to be wrapped into a conditional. <Post key={post?.id} id={post?.id} title = {post?.title.rendered} link = {post?.link} img = {post && post._embedded && post._embedded[‘wp:featuredmedia’] ? post._embedded[‘wp:featuredmedia’][0].source_url : ‘ ‘ } category = {post?.categories} />

WP_REST_Request::get_json_params() Parsing null as Zero

This is related to how you declare the parameter types for the endpoint. If you use integer then the parameters will be converted to integers, so in cases where a null value is being used you will get 0. The solution is to add support for both integer and null e.g. ‘type’ => [‘integer’, ‘null’],

Rest api request throttling

I wasn’t sure from the Laravel docs exactly how it works there, but there are a couple of security plugins (at least) that have rate limiting on a per-IP basis: ShieldPRO WordFence This may be more useful, however, as it is focused only on rate limiting and isn’t a product, and would be more flexible … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)