Add a rewrite endpoint to give your plugin a public URL-
function wpa_my_endpoint(){
add_rewrite_endpoint( 'my_api', EP_ROOT );
}
add_action( 'init', 'wpa_my_endpoint' );
After you flush rewrite rules, you’ll have the URL available for the scheduler to ping.
Then catch those requests on the parse_query
action to invoke your plugin action:
function wpa_parse_query( $query ){
if( isset( $query->query_vars['my_api'] ) ){
include( plugin_dir_path( __FILE__ ) . 'stuff/things.php');
exit;
}
}
add_action( 'parse_query', 'wpa_parse_query' );
Related Posts:
- Open Post Thumbnail in New Child Theme File in WordPress
- wp-load.php redeclares classes
- I created a plugin with ‘view page’ that uses MYSQL + PHP. When I use wp_insert_post(), it turns everything to HTML
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- Get Core Functionality from Within a (Secondary) Plugin File
- Pass PHP variable to javascript
- Namespaces in WordPress – How do I initiate the main class?
- wordpress get meta value by meta key
- What areas to Unit test while building a plugin?
- Add CSS animation as Preloader to WordPress
- remove custom taxonomy metabox form custom post type
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- Deleting images through upload folder, but not deleting from media library
- how to use ajax to display from database and load more in wordpress plugin
- WordPress plugin installation
- Get image URL from media library in input
- How could I execute my plugin just in frontend (not in backend)
- Create or Update thousands of woocommerce products via PHP
- Custom height/width for thickbox in WP Backend
- add action wp_head not working
- Adding content before the loop in category pages
- WP Plugin Developers – Accessing my wordpress site [closed]
- Update Option Error: Notice: Undefined index
- Why this global array is returning NULL from a callback function
- Next and/or previous post content
- Why my Plugin keeps deactivating automatically?
- Self deactivate plugins after an action occurs
- How to get current post user id
- How to periodically scrape and cache strings from remote txt files. – My First Plugin
- switched from query_posts to WP_query, not working now?
- How to find the origin of a file upload from within wp_handle_upload?
- Using a custom plugin to capture input data via Ajax and PHP
- Display post lists in 2nd paragraph
- Ajax contact form widget plugin data not insert in database
- Install Plugin via Code
- Single API call exposed via shortcode with params
- How to output CMB2 select options from repeated groups select elements?
- Is there a way to test that readme looks in other language before submitting translation?
- What would I need to write into a custom plugin in order to add a switch for a custom string of CSS to the edit page?
- Homemade plugin while using Themify Ultra
- How to deal with WordPress and Pocket API to automate content curation on my hosted wordpress blog? [closed]
- WP All Import – Execute Imports
- Create tabs in admin options page from custom post type loop
- ob_start() combined with wp_query
- do_action() hook into load-(page)
- WordPress get_avatar function not correct working
- How can i create page through plugin
- Can I use Symfony components in a plugin that I want to submit to the WordPress plugin repository?
- Custom license for WordPress plugin
- Does using `add_action( ‘init’…` cause performance issues?
- Custom Login Page — wp_signon Headers Already Sent?
- Add User Role: Pre-saved in User-Meta [SOLVED]
- Add_rewrite_endpoint doesn’t work with post name permalink structure
- How to create plugin/ page that reads from database
- How WordPress core manage the plugin installation
- Why is my WordPress Plugin page requesting my FTP Login Credentials?
- Cross Sells are not being shown in Cart Page. Please Help!
- Plugin not properly prepared for localization
- WordPress Active Plugins
- adding custom code as a wordpress plugin
- How to add filter for wordpress plugin?
- count the number of views of a post excluding own views
- How To Create A File Archive in WordPress?
- Adding a jQuery modal dialog to the admin area
- Custom Post Type, Custom Columns List
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- How to upload large media file in chunks, without any plugin?
- How to set Google Analytics tracking code on WordPress plugin directory page?
- How to add styles to a submenu page?
- How to store a secret for a plugin inside public_html
- Problem with checked box on wp car manager plugin
- How to use functions found inside pluggable.php with my plugin files
- Is it okay to make a plugin to the WordPress repo, but limit it’s actions to maximum N events?
- Create a link that calls our custom function in WordPress
- Update a previous version of plugin when the new plugin is built from the scratch
- AJAX update fails for public/non-admin users
- WordPress Product Detail and catalog
- Woocommerce list variations that are added already to cart in Single Product
- Plugin json page
- How do I add a textarea (multirow) option to my WordPress plugin?
- Passing ajax variable to more than one wordpress plugin function
- search into subcategories plugin subcategory value not come
- Why isn’t my plugin seeing other classes?
- How Can the_post Be Hooked Like the_content and the_excerpt?
- Create Database Tables on Plugin Activation hook
- Update post meta not working on wp_postmeta
- How to tell which Plugin is displaying?
- Change page according to fetched GET Parameters
- wp_insert_post_data filter to set category
- Plugin keeps saying needs to be updated and it’s in a constant loop [closed]
- is there a way I can add or remove some plugin options?
- How to provide access to specific plugin to all the user roles except subscriber in wordpress
- Output pure JSON wordpress
- how to remove a rel=”nofollow” using call to action plugin
- Activate plugin button do nothing [closed]
- How can I make my plugin detect if a certain theme is active?
- Is it possible to create post in wordpress using postman?
- wp_enqueue_script doesn’t load JS in plugin
- AI Code For OpenAI
- Pulsing circle before the post title (Breaking news flash)