You could add the path argument to the get_rest_url()
function as per the WordPress Developer docs – https://developer.wordpress.org/reference/functions/get_rest_url/ – in order to get the path you need:
get_rest_url( null, 'wp/v2/' );
This would produce: http://mywebsite.com/wp-json/wp/v2/
Related Posts:
- Can a theme be built in React?
- Edit srcset and sizes attributes in Gutenberg image, cover and gallery – blocks
- wp_remote_get times out on api request but jquery GET and postman work?
- Why WordPress AJAX returns undefined however it works fine when I add static url instead of dynamic function?
- “The REST API did not process the context query parameter correctly.” Custom theme conflicting with Media Library
- How to get custom logo with REST API instead of get_theme_mod();
- Can I set rest API endpoints from within a theme?
- Woocommerce REST API for my account & checkout process
- Different WP Rest API custom endpoints across different themes
- .htaccess and proxy settings for routing a decoupled REST API consuming theme
- How can I enforce user to use Application password to generate JWT token? [closed]
- Software for WordPress Theme and Plugin Development? [closed]
- How to override pluggable function in theme?
- Should we use get_template_part() in functions files instead of include_once?
- Reset positions of metaboxes in admin
- Remove the word ‘Categories’ from wp_list_categories
- Using Bootstrap in themes
- Add a dropdown to theme customizer
- design and development workflow
- How to control initial wp_head() output?
- enqueue script for specific shortcode
- The difference between calling wp_enqueue_scripts to load scripts and styles in custom theme
- Any walker causes blank menu?
- How can I insert default widgets when my theme is activated (similar to what twenty eleven does)?
- How to change post thumbnail title and alt attributes to post title?
- Why might $input (Settings API) be coming through empty?
- add generated stylesheet from parent theme after child-themes style.css
- date_i18n() issue
- Creating Page Based on Category
- How to check if post has any tag?
- using wp_enqueue_script to attach jquery-ui
- Merging PHP download script into `functions.php`
- Should use widgets in this case?
- Changing the entire control choices using wp.customize with JavaScript
- Can not Remove Archives and Meta from Sidebar
- Get last modified date for menu link
- How to add multiple custom widget areas
- A theme that follows all the best practices to learn from?
- get_post() function returns post even if it is trashed
- WordPress how to override function adjacent_posts_rel_link_wp_head() in link-template.php the correct way
- Can wordpress run in root of existing php site with no theme on index.php but all other WP posts/pages?
- How to regenerate thumbnails when they’re stored on S3
- Change file name from wp_generate_attachment_metadata
- Change setting name in Customizer and keep the data
- CSS won’t style output of wp_nav_menu() correctly
- How can I disable/hide certain themes in multisite?
- Some doubts about how to show posts in a custom theme?
- Why are theme templates organized as multiple point of entry PHP files instead of reusing your theme’s index.php?
- How to add a second stylesheet to the editor
- Single Page theme [closed]
- How to create a custom template to admin dashboard
- Change The Meta-Description Of Home-Page?
- filter “inactive” categories from wp_list_categories?
- Easy lightbox effect inside of dashboard widget
- Add, edit specific CPT with custom role
- how to display search term in the template full site editor
- Custom Field created in add_meta_boxes reappearing itself again in the default Custom Metabox
- Dynamically generated wordpress customizer options?
- Filter categories used with Custom Structure Permalink
- Code to determine WP version check
- cannot echo the_post_thumbnails
- How to escape html generate by a loop
- get_term_link is Ending to single.php
- making my theme multisite compatible?
- wp e-commerce – theme problem – why won’t it load wpsc-single_product.php? [closed]
- theme style is applied on the dhasboard rather than the website
- Moving post title down the page / Removing a block from a post
- I want to change background image of my wordpress site on particular post type
- how to retrieve the image title for image Post Format
- Hestia Child theme creation
- CSS added through customizer neglects the need of a child theme?
- How to add custom class to get_avatar()
- Want to add cart and a search bar in the right of logo line
- Output richtext metabox value
- Twenty Twelve Author not displaying
- Default PHP document / names needed for a WordPress theme?
- Custom fields for custom post types
- How can I sort my loop based on meta data, using a form?
- What is the_permalink() on a category page?
- How to modify theme content in Thematic?
- Sidebar not displaying (theme development)
- WordPress theme options checkbox default checked state
- Custom themes that won’t work when theme is changed
- only the first post is shown
- wordpress can’t find single-project page
- WordPress Theme: What is the right way to put inline CSS loading from a CSS file
- Is there a way to add classes to a page when using a Gutenberg reusable block as page layout?
- Cold Fusion to WordPress
- How do I build a WordPress Profile/Author Header?
- Create settings field on button click
- get_posts is duplicating
- Undefined index: custom_sidebars
- How To Customise WordPress Comment Submit Button?
- Single Featured Image Repeating
- How to remove menu from WP-Admin menu
- apply_filters to featured image
- How do I move menu to the bottom in Custom Community theme?
- How do I get information about a page, such as featured image, except, and title?
- Add wrapper for a specific sub-menu
- Not Able to Access Terms Under Custom Taxonomy Archive