It’s a pretty simple solution – WP_Query utilizes the name variable for posts and custom post type posts. It utilizes pagename for pages, hence why ?name=product1-faqs is not working. Use this instead:
add_rewrite_rule('product1/faqs/?', 'index.php?pagename=product1-faqs', 'top');
Related Posts:
- How can I modify the permalink via a filter?
- Newbie question: no index.php? in my plain wordpress permalink
- 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?
- 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?
- Performance impact of rewriting WordPress URLs
- Is sanitize_title_with_dashes formatting function too liberal (in terms of accepted characters)?
- 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]
- 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
- How to add a rewrite endpoint to unattached media?
- 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
- 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
- Current WordPress Page Title as Search Parameter into A Tag
- How does one make a URL return dynamic JSON with custom Content Type?
- 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
- Remove slug of multiple custom post types with and without hierarchical
- What would be a PHP command to erase all posts from category X from the last month?
- Accessing a random image via ajax
- my function doesn’t return my post from today
- get_the_terms – only top level
- Have CSS Class Added with `is_page()` WP function
- Category Thumbnail Display – How to display ONLY the main Category
- Using a `Template Parts` folder instead of an `Includes` folder in a Custom WordPress Theme
- Call global variable array() in woocommerce child/template
- How to add a php custom page to WordPress
- How to Add Extra Search terms with WordPress Search keyword term?
- How do I add custom bulk actions to multiple custom post types?
- Post + form + action + results on the same page
- Hardening uploads folder in IIS breaks images
- Creating a mobile site by adding a new class to the body tag from functions.php
- Using WP functions such as the_title() in an included php file
- How to get thumbnail with pure PHP in a WordPress database?
- Edit Account – read and write to MySQL
- Looping through 3 recent posts but separating them into separate divs
- OG:Audio facebook meta tags
- WordPress stripping out custom field tags
- understand what code is doing when prepending /blog
- Show next image in array if page is revisited by same logged user
- PHP Fatal error: Uncaught Error: Call to a member function atp_variable() on null
- Adding markup to sub menu based on class
- How to create a subdirectory in a child-theme via functions.php from the Theme editor without FTP acces?
- Set ACF on order during checkout
- Fatal error: wp-settings.php on line 199
- Show a text if the post has written by author user role in WordPress
- Add Admin Option w/ Anonymous Function
- Getting data from serilized array
- Form direction to .php on localhost
- Can form entries from a WordPress form go to a database
- News and Featured image
- add conditionals to a displayed external xml feed
- Warning: Cannot modify header information (with a twist)
- where is the mistake in PHP Warning: Invalid argument supplied for foreach() in line 3
- Echo piece of code from file
- WPMU – How to echo only one URL
- Display terms on product page with shotrcode
- How to build a dropdown with tags for same post type?
- WCFM Custom form
- getJSON response to PHP
- Custom plugin with shortcode not working
- Get category name of current post (CPT UI)
- Count post with tags within one category?
- counting slugs not working?
- Is it possible to remove the “Shop” title from the WooCommerce catalogue? [closed]