You can use the page_link
filter with the same logic as the page_template
filter in the other answer. If the endpoint query var is set, then any link to a page gets the app-view/
appended:
function wpd_page_link( $link, $post_id ){
global $wp_query;
if( isset( $wp_query->query_vars['app-view'] ) ){
return $link . 'app-view/';
}
return $link;
}
add_filter( 'page_link', 'wpd_page_link', 10, 2 );
Related Posts:
- How can I load a page template from a plugin?
- Passing parameters to a custom page template using clean urls
- Using a page template without a page
- Include a page template along with add_theme_support()
- Create built-in pages without creating actual pages
- How to change/rewrite the lost password url?
- Load different template file when condition met?
- Changing document title only on a custom page template
- Possible to filter the posts or categories that XML-RPC users see in their mobile application?
- Problem getting single_template filter to work – I want to serve a different single.php file for posts in a certain category
- How to add attributes to tag when template cannot be directly modified
- How do I hide the current page’s title?
- theme_page_templates not working
- Create Page Template by hook programatically in Functions.php in WP 5.8.1
- Display Externally Retrieved Data within a Custom Template
- I can not include page to wordpress function add_filter, the_content
- Adding a filter to comments_template
- Change the template when the user is not logged in using page_template filter (it does not work)
- Rewrite rule and display of post
- Access or edit custom generated permalinks with WP_Rewrite
- How do I hide tinymce within the edit screen of a particular page
- Shortcode / plugin with custom (flexible) output
- output custom Posts on a Page
- How to redirect template_directory to subdomain relativ url?
- Would like to use hook or filters to customize email templates
- How can I filter same content in page
- Custom permalink for attachment
- the_content filter not working when Jetpack activated. Any idea?
- Change URLs in default WordPress slider to relative from absolute
- Adding Filter | Page Title | Template | Why the_title affecting on menu?
- What action/filter can be used for modifying the page to be rendered?
- Change url to posts if they have custom tax only
- Show child theme for users on specific IP
- Remove action added from class
- WordPress URL rewrite problem
- get_the_excerpt on mobile still displays continue reading
- if i put the code in my theme’s function.php file can it work?
- How could I create real-time filtering in this case?
- Ship block templates or block template parts with plugins
- Disable emojicons introduced with WP 4.2
- Create custom page templates with plugins?
- How to create custom URL routes?
- How to remove a filter that is an anonymous object?
- WordPress hooks/filters insert before content or after title
- How to add defer=”defer” tag in plugin javascripts?
- Custom templates not showing up in template dropdown
- add_action(), add_filter() before or after function
- apply_filters(‘the_content’, $content) vs do_shortcode($content)
- How do filters and hooks really work in PHP
- single-{$post_type}-{slug}.php for custom post types
- Trouble understanding apply_filters()
- What is the very earliest action hook you can call?
- Use a template file for a specific url without creating a page
- How would one modify the filtering Gutenberg applies to pasted content?
- How can I modify the WordPress default widget output?
- Add custom options to the wplink dialog
- Remove classes from body_class
- what is __return_false in filters
- Explanation for apply_filters function and its variables
- Gutenberg: Is there a way to know if current block is inside InnerBlocks?
- How to reorder billing fields in WooCommerce Checkout template? [closed]
- Insert HTML just after tag
- the_content and is_main_query
- Changing WooCommerce Display Price Based on User Role & Category [closed]
- How to add a custom CSS class to core blocks in Gutenberg editor?
- How to show page content in feed?
- wp_headers vs send_headers. When to use each?
- Filter any HTTP request URI?
- How to Pass External Variables to Filters/Actions
- How to filter users on admin users page by custom meta field?
- Filter by one custom field, order by another?
- Not able to change wp_title using add_filter
- How to appending to the_content using add_filter with custom post type?
- Query WP REST API v2 by multiple meta keys
- No filter of code on switch from html to visual editor, how?
- Sanitize and data validation with apply_filters() function
- How to modify posts_where filter only for the search query
- How to hook a filter to catch get_post_meta when alternate a custom field output?
- How to get shortcode’s input values inside a filter?
- Removing Image and Caption Dimension Attributes
- How to wrap oEmbed-embedded video in DIV tags inside the_content?
- How to bulk delete all users with no posts?
- How many filter/action hooks are healthy?
- WordPress 3.9 – Trouble Editing TinyMCE 4.0
- Changing JPEG compression depending on image size
- How to add filter with 2 args?
- Is there a WordPress plugin that registers a plugin file as a custom page template?
- Why is javascript allowed in my post content?
- How to use update_{$meta_type}_metadata filter to modify meta value
- How to wrap an element around an iframe or embed in content automatically?
- Filter specific shortcode output?
- WordPress Internal @ Mentions
- How to add headers to outgoing email?
- Earliest hook to reliably get $post/$posts
- Page editor missing Templates drop down
- Insert new element to array with add_filter
- How to retrieve $_GET variables from rewritten URLs?
- Is it possible to stop selected plugins from loading on certain template pages?
- LESS CSS enqueue_style with add_filter to change rel attribute
- Is it possible to filter comments in a post so a user can only see the comments they have written?