If you’re using WordPress 4.6, you can use the REST API without the need for the plugin by simply using the following:
add_action('rest_api_init', function() {
$namespace="myapi";
register_rest_route($namespace, '/myroute', array(
'methods' => 'GET',
'callback' => 'handle_my_route'
), true);
function handle_my_route() {
return 'Hello World!';
}
}
Then, going to: yourwebsite/wp-json/myapi/myroute
would return the callback value, which in the case above is ‘Hello World’.
Related Posts:
- How to call a function in wordpress plugin from another site
- Redirect to another page using contact form 7? [closed]
- Get User_id outside wordpress,
- How can I call a function from one plugin within another plugin?
- How to tell if Jetpack’s Photon is active?
- How can I modify the Capability needed to access a plugin’s options?
- Open Source plugin and requires licence
- How to delete the Hello Dolly plugin automatically?
- Fatal error: Call to undefined function wp_get_current_user()
- Delete option doesn’t appear for plugins
- How can I include a setting that has a variable number of values in a settings page using register_setting?
- How to use WP-FirePHP extension?
- WP plugin updates
- change plugin shortcode function [closed]
- woocomerce variations [closed]
- How to use load_plugin_textdomain from within a theme
- Yoast SEO blocking/re-initialising longer running process
- template_redirect not being called when using ajax
- Syntax Highlighting Plugins and 3.2.1
- Problem Building a Simple Google Maps Plugin
- Is there a way to alter the order in which the plugins appear in the page?
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- How to display sub categories under products page using woocommerce with mystile theme [closed]
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Post-terms-order PHP errors after update
- Do I still need a theme to use page builders?
- Plugin Options Not Saving to Database in WP 4.5
- Standard Fail2Ban vs. WP Fail2ban vs. WP Fail2Ban Redux
- Install (enable) plugins on multisite, on localhost
- Individual testimonial taxonomy not displaying (white screen)
- “Custom Post Type Permalinks” plugin URL strcuture
- WooCommerce search products between price range using WP_Query
- Stop WordPress processing Javascript as text
- register_activation_hook in oop approach
- Can free plugin on WordPress.org site promote pro-version of this plugin?
- Add script into front from my plugin
- Meta box losing its value when scheduled post is published
- Make thumbnails on product-category pages the same size [WooCommerce] [closed]
- how to change automatic placing of social plugins below content?
- Why is the ‘Gutenberg’ Plugin generating an ‘Inconsistent File Permissions’ error when other Plugins, with the same permissions, do not?
- Disable Plugin with one button
- Exact Hook to payment methods
- Using wordpress translations strings in plugin
- Are mu-plugins plugins still deployed via wordpress.org/plugins?
- How to make my blog available to other website using RSS feed?
- How can I modify page content in the admin panel?
- WordPress programming video tutorials [closed]
- WordPress front end AJAX. Return 0 :?
- WordPress 5.4 – How to prevent to enter only certain values in custom field
- Displaying content based on drop-down menu selection sitewide
- DB Query not working in Plugin
- WordPress Multi-Step Product Search
- Woocommerce Free shipping method [closed]
- Is there a way to remove plugins in dashboard – where you cannot identify the slug by the plugins name?
- Blocking Plugin Css to load custom in template directory
- Using Amazon Book Gallery Plugins in WordPress [closed]
- How can I create custom in-post templates?
- unregister a sidebar widget
- Could add_query_arg() redirect user to external site?
- Plugins to generate reflinks in WordPress
- How to make if statement in react plugin?
- Use a hook or filter, or overwrite this Gamipress function?
- How to add label/badge on bookable product based on their booking status
- Does anyone know why my SEO and title become one?
- save_post hook partly firing in update post
- Wp-cron.php firing too many times , even disabled in wordpress wp-config.php,
- Help to create function that changes name in the certificate of the sensei lms
- Get Shortcode output to database for static post_content
- Show post object of any page in frontend
- After migrating with duplicator all scripts are still tied to old CDN
- How to prevent redoing get_posts queries and make results available to other scripts?
- strtotime not working
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- WP Job Manager Feature jobs from [job_dashboard] page [closed]
- Optimized PHP & WordPress settings for speed/performance?
- Speeding up WordPress on a Local Network
- Get only selected custom taxonomy
- how change my menu on submenu
- Using slightly modified widget
- WordPress update plugin through Dashboard/Plugins displaying error
- Alter add_meta_box
- Authenticating custom field on login
- WP internationalization not loaded
- Adding custom cron_schedule prior to wp_schedule_event
- Create plugin with form in post and submit it to specific form
- Capturing POST data
- WP-PostRatings – how to make rating show up?
- Making plugin to use different table prefix cause permission problem
- Auto play audio using WP Maintenance Mode Plugin [closed]
- Plugin to allow for recurrent subscription + exclusive content
- How to automatically convert “normal” conditions to yoda conditions
- Woocommerce Large Variations Shows Out of Stock Items [closed]
- Plugin LDAP Authentication 2 In stallation ploblem
- woocommerce how to get cat id in content-product.php
- How to use WP-reCAPTCHA on a form
- Text Wrapping in WPDataTables
- how to show selected options drop down menu values in attributes field in after saving post.php
- Buffered output in chunks and shortcode – how do I achieve that?
- Transfer wordpress comments form on another post [closed]
- Achieve the following layout