You can check for the presence of a specific query variable, so http://www.example.com?my_listener=test. You check for this on the init hook and if it isn’t there you just quit early and WP goes about it’s business. If it is there, you can then do something, just don’t forget to exit at the end or the full page loads and that can mess up the response you are trying to send to your app.
function wpa_91930() {
// if query var is not present just return
if ( ! isset( $_REQUEST['my_listener'] ) || 'test' != $_REQUEST['my_listener'] )
return;
// send response
echo "it works";
// don't forget to exit when you are done
exit;
}
add_action( 'init', 'wpa_91930' );
Related Posts:
- What’s the difference between home_url() and site_url()
- Prevent “main” WPMU site_url() being returned in functions
- Custom page with variables in url. Nice url with add_rewrite_rule
- Is it possible to use a forgot password url filter?
- Create Custom URL structure for specific Post category
- How can I rename the WordPress AJAX URL? [duplicate]
- Ninja form Redirect depending on text field content [closed]
- wp-comment author- url +, email filter hook
- Removing custom meta data
- WordPress on AWS Auto scaling and ELB giving 503
- WordPress converts media extention URL automatically to video player
- meta tags doesnt fetch data from permalinks
- Get arguments from URL
- Add unique id to Preview URL
- How can I set the SRC URL of the custom logo image?
- Need to convert image url to a Base_64 data url with wordpress function..
- Protect get_query_var from manual input in url
- Problem with images URL after filter applying
- How i can get the URL?
- include w_thumbnail_src in function?
- Create Custom URL structure for specific Post category using Post ID instead of post name
- Fetch URL parameter
- how can I change all wordpress media file url to custom cdn url?
- Custom route and extract data from slashes and parameter
- reWrite wp-content url to point on my cdn
- How to Override Page Template if URL matches query?
- Add #primary at the end of navlink permalinks on single posts
- Set URL Parameter Post Layout As Default
- Using Switch Statement to Change Image According to Last Digit of Topic ID
- Instead of using $post, how do i get the thumbnail image of the $post
- How to add a meta information to the URL?
- How do I change the URL returned by next_posts_link()?
- What is the “with_front” rewrite key?
- Display random categories on the front page (Finding and Editing Theme Functions)
- Filter the query ONLY for the search results page
- How to add attributes to a shortcode
- Delete expired posts after a number of days after they expired
- How to use get_template_directory_uri() to load an image that is in a sub-folder of my theme?
- Automatically set the featured image
- How to target specific wp_nav_menu in function?
- Customize WordPress Media Manager – Media Window
- Help me to understand wp_header() and wp_footer() functions
- How to call WordPress functions from a form processing script
- Apply jquery script to only woocommerce product pages and categories
- How to override functions.php in child theme?
- Is it possible to maintain image aspect ratio when scaling images?
- How do you permanently remove default rewrite rules from the wp_options table?
- Can shortcodes contain conditional statements? Even without them my shortcode renders blank page
- Remove Page Title from Static Frontpage
- How to override WordPress registration and insert an auto-generated username?
- Most elegant way to enqueue scripts in function.php with foreach loop
- Breadcrumb how i can display page title with parent > child title with permalink ? any Idea
- change a post status when users update posts?
- How often is functions.php loaded?
- update_post_meta for custom field not working upon form submission
- Custom page template how to check is_page from functions.php?
- how to get and display logged in user’s recently read posts
- Display height and width properties with the_post_thumbnail() or related function
- Cleaner way to access custom fields in code?
- Add a new subscriber role using a function
- Why functions.php file is called 8 time for just one page load?
- How to override enqueued styles using a child theme
- Display a text message if the shortcode is found?
- How to store / access files in child theme folder
- How to set the jpg image compression for specific thumbnail sizes?
- Function to auto-set a featured image that is already in use
- Delete pages and Create default pages for all new network sites
- Actions according to image type and size
- How to use IF Statement in WordPress?
- Woocommerce Storefront WordPress Ignore Media Gallery Images and use External 3rd Party Host
- Post thumbnail relative link and HTML modify
- Find first image on paginated post for Pinterest
- How would go about if I just want a temporary function?
- How do I edit wp_head and/or functions.php to remove rss-feed which isnt used and dont validate?
- Generating rel=prev and rel=next only on wordpress categories
- How do I get a child theme to load scripts from the parent theme?
- How to make applyFilters function return false via functions.php
- Access / Filter block variations in Gutenberg, in WordPress 5.6
- example of build_query function?
- Custom HTML in specific category single page and its descendant categories
- Avoid loading css from parent theme
- retrieve current user meta data (custom fields included)
- Calling a function from anywhere, used in different places
- How do I redirect all 404 error url to Subcategory url
- Modify a function without editing template
- How to hide unused profile fields?
- async javascript and css for wordpress
- Override widget in function WordPress
- WooCommerce – Want to show multiple currency for a single product [closed]
- How to change or add user role after getting post request data about pay? [closed]
- How add various functions within 1 conditional?
- Disable auto-resizing of uploaded images, but only for certain filename
- Add to cart php not working [closed]
- Create cron job for update translations automatically
- Login Redirect if Logged in from Specific Page
- get_next_posts_link not working without parameter max_num_pages
- create filter in functions.php
- Automatically include all php files in a child theme directory
- Override the function twentytwelve_scripts_styles in a child theme
- Custom taxonomy widget in admin area