Render link description in navigation block

I solve this problem by using WordPress Filter hooks I use the filter render_block, to hook in altering the existing HTML So I created custom_render_block_core_navigation_submenu hook function. Inside my hook I am using conditions to avoid storing my modified code in the database. Target the type of block (core/navigation-submenu) Only render in the front-end Don’t alter … Read more

Can’t expose custom field to REST API

I think the problem here is how you register the rest routes and how you return data for the single project endpoint. When you register the route and the callback like this. function single_project($data) { $post_ID = $data[‘id’]; return get_post($post_ID); } add_action(‘rest_api_init’, function () { register_rest_route( ‘project/v1’, ‘post/(?P<id>\d+)’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘single_project’, … Read more

Deleting all CPT related to user deleting

Using the action hook delete_user is the right way to do it, but there are a couple of things missing. The main one being that you haven’t set up any $args for the WP_Query that fetches the custom post type entries with the user-id metakey of the deleted user. add_action( ‘delete_user’, ‘delete_his_posts’); function delete_his_posts($user_id) { … Read more