If you’re just going to output your own data, there’s no reason to wait for the main query to run. Hook parse_request
and check if your page was requested and run your code there.
function wpd_maybe_output_feed( $request ){
if( isset( $request->query_vars['pagename'] )
&& 'gmailrss' == $request->query_vars['pagename'] ){
header('Content-Type:text/xml; charset=UTF-8');
echo checkGmail("gmail", "password");
die;
}
return $request;
}
add_action( 'parse_request', 'wpd_maybe_output_feed' );
Related Posts:
- Remove tag on my RSS Feed
- RSS Feed has no styles in chrome – function to add one?
- Completely disable RSS feeds on WP 5.5.2 and show a 404 page instead of die();
- How do I edit wp_head and/or functions.php to remove rss-feed which isnt used and dont validate?
- Display Password Protected external RSS in wordpress template
- Get the link for RSS item to display in feed
- custom rss templete
- Why is my page feed returning empty content?
- How to remove style attribute in WordPress RSS output?
- Access category within rss2_head hook?
- Is posible to redirect a few URL?
- Completely Disable WordPress RSS Feeds
- Hide disclaimer from summary excerpts
- RSS feed including post updates
- How to check if a user exists by a given id
- How to use the do_action () with parameter
- TinyMCE custom styles remove class when switching styles
- Extending the site search to include a single custom field
- Notify users whenever a new post is published based on their preference
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- syntax for remove_filter in parent theme with class
- Remove Header and Footer in iframe
- How to Acheive the custom woocommerce category template
- Can I remove the Rich Text box editor for a specific post?
- Formatting post content to exclude gallery
- Why do I get undefined function export_wp()?
- Redirect if not logged in?
- How to set global variables in template page?
- Programmatically set page template based on page ID
- Setting featured image with function, 1 part not working
- Function to show only first instance of shortcode
- Best way to programatically add “rel” attributes to page and post images
- Comments to only be seen by their author
- Remove function or filter
- options.php problem – data not saved
- Filtering posts by category name based on page’s slug
- adding custom classes for tables
- Load parent theme files before child theme functions.php
- CSS for menu item added via functions.php
- Two functions.php files in one theme
- Default Gallery Edit/Template Editable?
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name
- Make parent page only link to first subpage
- How to validate this deprecated function
- How can I modify all existing tags while keeping the urls themselves?
- Scripts not appending to element in AJAX call – why?
- Trigger a custom function when option are saved in admin area
- Functions.php – Cannot Modify Header Information SOLVED [closed]
- How would I add “edit profile” and “blog post” functions to front-end?
- shortcode help require
- How can I add a filter for specific categories on functions.php?
- Custom editor color palette colors are not appearing in the editor
- Set Taxonomy based on post status
- echo custom fields with AJAX
- How to create a functions.php in child theme? [closed]
- wordpress get_post_meta give only first value
- Using multiple line variable inside a function?
- Determine if, within a post, you are on page 2 or greater – WordPress documentation circular
- Wp-query Order By problem
- WordPress Excerpt – How to remove the first link using functions.php
- Compare meta key to current date in pre get post
- Is there a built-in function to duplicate existing posts?
- load CSS only for administrators on backend
- Insert Address fields into function
- Protect get_query_var from manual input in url
- How to remove admin footer text from inside child theme?
- Shortcode to get featured image of specific id post
- Show admin page, only if function is being used
- Fatal error: allowed memory size when after using enqueue_script
- How to apply the ‘current_page_item’ class to an archive page in `wp_list_pages()`?
- How to redirect Subscribers on login to specific page, when logging in from a Page
- how can I add filter in specfic field in my website?
- functions.php pharse error on complete new install
- If has action not working as expected
- Update wp_postmeta table based on 2 keys
- Best practice to call a function from a button-link?
- Disable wordpress update notification
- How to customize archive widget only for cpt?
- some profile informations like youtube link doesnt seem
- Help using ShortCodes to style whole chunks of the post
- Extend WordPress Audio Widget to accept HLS (.m3u8) URLs
- How to modify or override a core function (wp_star_rating)
- Is there is a way to check daily first login?
- Filter posts on new page
- Sticky – Featured Image
- delete_user_meta for user in spesific group
- Pagination not working on my archive page for a custom post type
- Remove Featured Images from Posts Older Than a Certain Date
- How to pass a variable from a template page to the child theme functions.php
- Home/Static Page View for Visitors pages after that should be restricted
- functions.php filters not applied in AJAX call
- Settings in functions.php used by a plugin
- Make WordPress search for only this tags or exclude certain tags from search [duplicate]
- Adding result from PHP function into an input field
- Using array page name together with page id to deregister script
- Echo a div to header.php from functions.php
- Modifying Page-Links format
- how to handle multiple forloop?
- PHP error in shortcode [closed]
- comment_post function with js not running