I finally got my rewrite rules to work here:
$home = get_post(Sunshine::$options['page']);
// Gallery
add_rewrite_rule($home->post_name."/gallery/([^/]+)/page/?([0-9]{1,})/?$",'index.php?pagename=".$home->post_name."&sunshine_gallery=$matches[1]&paged=$matches[2]','top');
add_rewrite_rule($home->post_name."/gallery/([^/]+)/?$",'index.php?p='.$home->post_name.'&sunshine_gallery=$matches[1]','top');
add_rewrite_rule($home->post_name."/gallery/([^/]+)/?$",'index.php?pagename=".$home->post_name."&sunshine_gallery=$matches[1]','top');
// Image
add_rewrite_rule($home->post_name."/image/([^/]+)/?$",'index.php?pagename=".$home->post_name."&sunshine_image=$matches[1]','top');
Related Posts:
- Custom pages with plugin
- Add rewrite rule to permalink structure
- Add Rewrite Rule for custom page
- How Do I add a redirect rule to WordPress?
- add_rewrite_rule, plugin activation and plugin deactivation
- Using rewrite rule to access a view of a plugin from home page
- flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404
- Custom rewrite rule is not picked by WordPress
- flush rewrite rules doesn’t flush them (still got 404)
- Does flush_rewrite_rules() remove all rules added by other plugins as well as mine?
- Add_rewrite_rule doesn’t add custom url in plugin
- How can I rewrite a plugin generated URL?
- flush_rewrite_rules() not working on plugin activation
- WordPress custom URL Rewrites redirecting not masking
- How to add rewrite rules and pagination to retrieve attachments files?
- Change settings of get_post_type_object
- Custom page slug without creating a WP page
- Remove rewrite rules generated by plugin during deactivation
- How does WP handle multiple matching rewrite rules?
- Custom rewrite rules not working with WPML
- Is it possible to use multiple post_name, post_title and post_content?
- register_taxonomy and variable rewrite slug
- Problem with Author page redirect
- How to Create a Custom Slug for Tags and Categories with a prefix or suffix?
- Redirect to another page using contact form 7? [closed]
- Remove .htaccess portion upon plugin deactivation?
- Custom url rewriting
- rewrite_rules() not applying rules on plugin activation only after permalinks menu is clicked
- URL rewrite with external JSON query
- WordPress rewrite rules not working
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- Passing value as hidden parameter to next page
- i want to rewrite my custom plugin url
- can’t install any wp plugins [duplicate]
- add_rewrite_rule to load different page, without changing URL in browser
- Having a problem with rewrite_rules and rewrite_tags – url not rewriting properly and query var missing
- Rewrite/Change custom taxonomy slug
- WordPress rewrite rule depend on meta values not ids
- Add custom WordPress admin page with pretty url via code
- Change custom rewrite rule when permalink is updated/changed
- plugin: rewrite rules are lost when WP updates
- Custom pages with plugin
- add_external_rule – rules deleted when visiting permalinks page
- How to disable wordpress page rewrite rule?
- Rewrite URL to plugin file
- How to programatically create a simple HTML page using the permalink of a WordPress post?
- Apache rewrite rules and wordpress problem
- How to get the parameters on page and avoid 404?
- How to create custom content on custom page from plugin?
- WP Job Manger change jobs url (NOT slug)
- URL Redirect on GoDaddy platform [closed]
- Proper Way to Modify Plugin
- How to get a variable number of posts per post type on the main loop?
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- Filter Hook on plugin update
- Generic plugin (de)activation hook?
- Is the WordPress HTTPS Plugin Still Safe To Use? [closed]
- How to prefix `attachment` permalinks with `attachment`?
- How do I register a stylesheet inside a WordPress widget?
- List users except current user using wp_dropdown_user? [closed]
- Multisite Backup Plugin [closed]
- Custom Text Under Navigation Links
- WordPress plugin for affiliate referral system
- WordPress 5 upgrade: until when is it safe to keep project running in 4.x?
- Write to / remove from default .htaccess file from plugin?
- How to Use Parameters with a Do_Action Function Within PHP Tags
- Landing Page Redirect Chain | http->https->https www
- Need to change url paramenter of share product pintrest [closed]
- Bootstrap and Custom CSS in custom plugin are being overwritten by theme
- wordpress file upload with ajax when site is ajaxyfi
- Create a plugin from within WordPress
- Error checking when future updates are automatic
- wc_get_template new template does not showing up
- Using custom php file for ajax url inside plugin
- Sending HTML email containing custom fields to site users from WordPress
- Override css rules of a plugin within my own theme
- Article content navigator in wordpress like mbaskool website
- Linked pages from plugin on front can’t see $wpdb
- Defining the value of a variable before a function?
- Unexpected character and syntax error on wp-includes/formatting.php [closed]
- My plugin runs on every single WordPress page, but I want it to run only on activation
- working code, not working – Plugin Dev
- category page multiple products add to cart any plugin available for woocommerce
- Can’t install plugins after updating to WordPress 4.9
- register_activation_hook doesn’t fire at all
- Cron jobs in wordpress
- Adding a custom page template to a plugin generated page
- History of page, interval of years
- How to fix On “An unexpected error occurred” message when I click on Add new theme or plugin?
- How to display post by date written (1974) and not date published (today)?
- Does Google detect files in the WordPress plugin directory
- Facebook Feed Grabber Cache Relative to Dev Machine, not Server Install
- How to remove message output for the WP-PostRatings Plugin?
- Pass strings to plugin function [closed]
- How can I replace the built in WordPress editor?
- Place max_execution_time in plugin [closed]
- Is there a WP-Plugin to convert PNG to GIF? [closed]
- make a new structure tag that does some processing
- Free multi dealer rental cars (sign up) [closed]
- is_user_logged_in() undefined at shutdown in plugin context