EP_ATTACHMENT
will insert rules for things attached to posts (and custom post types), but not unattached media.
You can make this work by adding it to EP_PAGES
instead-
add_rewrite_endpoint( 'foo', EP_PAGES );
Related Posts:
- How can I modify the permalink via a filter?
- Newbie question: no index.php? in my plain wordpress permalink
- Continue execution after WP REST API response
- Change links automatically to affiliate links
- Rewrite sub folder dynamically with country code in WordPress using PHP
- Use WordPress’ URL rewrite engine
- Rename “Portfolio” slug?
- How to rewrite URL with PHP variables with htaccess to a normal looking URL?
- WordPress custom slug (endpoint) and compare all links
- Static variable and add_rewrite_rule?
- Nesting if statements to echo only one string based on what tag was filtered?
- How to change home or site url using action hooks or filter?
- Why do WordPress rewriites seem to work differently for posts vs pages?
- Performance impact of rewriting WordPress URLs
- Is sanitize_title_with_dashes formatting function too liberal (in terms of accepted characters)?
- Using WP-API and SSE not authenticating user ID
- Changes in permalink structure in WordPress and how to apply to in-site links
- WordPress Persistent connection rule does not work for “posts”
- Append query string to all URL’s
- custom rewrite rule help! Custom rewrite rules not applying to custom post type
- subdirectory index.php is not working
- Use URL Rewrite as well as $_GET parameters in URL?
- How to modify URL (add GET values) after front end form submission?
- parts of url disappear when using # inside href=”” [closed]
- My php header() function is not working [closed]
- Create custom permalinks to show Custom Post Type’s relationship?
- Add .htm extention to a custom taxonomy
- Help with .htaccess and Login with Subfolders
- WordPress add_rewrite_rules for custom URLs ending in .html
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- Divi change project category slug
- Is this a correct usage of ob_start() in my WordPress project?
- Custom route and query
- How do i add slugs to a URL, but still redirecting to the same page
- Nginx WordPress and another Web app URL structure
- Custom post type url Rewrite (conflicting with page url)
- WordPress Rewrite Rule
- Why is home page content not displaying with this rewrite rule?
- Modifying WP URL handing code?
- How to deal with a GET variable of ‘name’?
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- How to pass username in affiliate link in wordpress website
- WP_REST_Response – How to return Gzip answer and add Content-encoding header?
- Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters
- url not using query string no longer working
- php code for outputting a custom page in my account
- Current WordPress Page Title as Search Parameter into A Tag
- How does one make a URL return dynamic JSON with custom Content Type?
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- URL rewrite rule
- How does WordPress rewrite URLS using its PHP scripts
- How can I turn a url with get method as a clean url with segment as the get method?
- WordPress Rewrite Issue
- How to print redirected query string variables to the page?
- Multiple URL from Custom post name
- Why isn’t my custom function kicking in from my functions.php file?
- Difference in Get Variable Location
- WordPress adding in site URL to header links
- Dynamically append custom post type to end of url
- WordPress add parameters with friendly url structure
- Custom taxonomy with page post type – WordPress
- What is different about using admin-ajax.php in an endpoint and just submitting a form from the front end?
- REST API Plugin Update call back not updating the plugin
- Remove slug of multiple custom post types with and without hierarchical
- How to Dynamically Change the author_base URL Slug by Language in WordPress?
- WordPress add_rewrite_rule not working with page_on_front
- how to show only specific category for a template
- how to make my website secured
- Trouble Installing WordPress Get PHP Not Running Answer
- Exclude category
- Why does abstracting html from plugin code result in loss of access to wordpress functions?
- How do I Import / Upload Files with jQuery AJAX?
- Show a different code on front page to other pages
- wordpress wp_enqueue_script() not working
- Shortcode returns values in the wrong order
- Building a WordPress App
- Theme requires allow_url_include = on in php.ini
- Custom plugin settings link doesn’t append current class to menu item when visited? Why?
- Make PHP work with HTML tags
- Does wordpress templates always in files or in database?
- WordPress admin-ajax.php 400 bad request
- Not connecting to database in file with multiple MySQL connections
- Which is the correct way to conditionally enqueue a CSS file?
- Custom Background by Page IDs
- how to remove colon and white space in a string by php
- Concatenate output of php function into string
- get_template_part for specific page
- Do wordpress create a new file for each new post?
- Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose
- Way to bulk make all my tags lowercase?
- Why File_exists returns true with or without ABSPATH?
- proper way to add css using functions.php?
- WordPress style.css not updating, only after theme reload
- WordPress automatically adds links to uploaded images
- $Wpdb post meta query is not working with mutliple meta keys and values? [closed]
- class_exists returns different values [closed]
- Remove author link wherever author’s name is display
- How do I create my own .php file with a code part and echo it on different pages?
- Security for data obtained from the database
- How to add specific meta tags to head of cart and checkout pages in woocommerce?