Whenever I create a plugin that needs permalinks enabled i check on the plugin activation and if its not set i display a message for the user:
// Add Check if permalinks are set on plugin activation
register_activation_hook( __FILE__, 'is_permalink_activate' );
function is_permalink_activate() {
//add notice if user needs to enable permalinks
if (! get_option('permalink_structure') )
add_action('admin_notices', 'permalink_structure_admin_notice');
}
function permalink_structure_admin_notice(){
echo '<div id="message" class="error"><p>Please Make sure to enable <a href="https://wordpress.stackexchange.com/questions/100961/options-permalink.php">Permalinks</a>.</p></div>';
}
Related Posts:
- Why doesn’t flush_rewrite_rules run on plugin activation?
- rewrite URL based on selected taxonomy for post page
- Remove custom post type slug from URL and add taxonomy Slug
- add_rewrite_rule behaving strangely
- Forward an old url rewrite scheme to a new one?
- How to use permalink query to go to specific tabs in posts
- Custom rewrite, url path with parameters to a page
- A tool to analyze rewrite rules? [closed]
- Making a plugin file accessible via url rewrite?
- How to Rewrite WordPress URL for a Plugin
- permalinks with get variables
- WordPress plugin how to run function when button is clicked
- Custom Rewriting to Plugin with Parameters
- Filter to change the content of 404 page
- Add rewrite rule in plugin: with .htaccess in plugin folder or using WordPress functions
- Removing rules from .htaccess
- Mapping multiple URLs to same page
- Use an empty page to build custom plugin output
- Rewrite Point Doesn’t Work on Custom Taxonomy
- Add Post and Comments menu no longer visible
- Rewrite url for existing page without flush_rewrite_rules
- Creating a path in a plugin to call a function
- Custom rewrite rule serves content, but returns 404 error code
- 404 errors after plugin options update and category base change
- How to change the URL pattern for single post view
- Redirect traffic to plugin
- Append country to ‘pretty’ url but serve same page
- Auto save permalink setting page with the plugin activation
- How To Consistently Enforce Rewrite Rule in Plugin Development
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- Help With Rewrite_Rules For a Custom Plug-In
- Append varible to url or set session
- Adding rewrite rule dynamically
- How can I turn a custom wordpress page into a product page?
- Problem with dinamic add_rewrite_rule()
- Custom Permalink to remove category word , keeping posts permalink with date?
- Help writing custom function with rewrite endpoint that generates a page from dynamic content
- Possible to get all posts with my shortcode?
- custom permalink’s rewrite rule for page id
- HowTo to add my rewrite rules at the beginning, redirect to the right page and flush the rules on plugin activation?
- Create page (not the post type) dynamically
- Show content without a post
- How can I add rewrite rules to a class-based plugin?
- How to get post image root URL?
- How to create new content type and flushes rewrite rules without visiting the permalinks page?
- configuration of .htaccess for add_rewrite_rule to make sense
- Plugin Development – Get Admin Url (Including cases where wp-admin is not used)
- How to embed a new string in url?
- Rewriting Image URLs from dynamic to original
- Changing permalink structure breaks link to .php file which generates files dynamically
- wp_insert_post generated mixed permalinks
- How to link to custom “archive like” page with custom permalink rules “dynamically”
- Custom Path for a Plugin
- Custom post type change permalink query
- Add variables from rewrite rules to query var
- Change cannonical URL after changing url with add_rewrite_rule()
- Home page is not loading, where in other pages are displaying on the site
- Disabling Yoast, All-in-One, and Rank Math on Certain Pages within a Plugin
- WordPress custom url without using any of the custom tags given
- Get the current post/page URL with plain permalinks
- Adding body class in author page for custom role
- Author Meta in Author URL Link
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- WordPress plugin how to run function when button is clicked
- Using meta_key & meta_value in add_rewrite_rule
- How to force download a plugin generated file?
- How to pass a more variable with page/subpage in Wordprees URL?
- Get (eventual) permalink from post within Edit Post in Admin panel
- Fixing the WP Post Object for Custom Route
- Any way to make Apache’s internal redirect work?
- WordPress permalink setting
- Rewriting URLs with a query string
- How can I send an id over the url?
- Custom slug in url for CPT and taxonomy
- add_rewrite_rule not working
- Mapping multiple URLs to same page
- Use custom clean URLs for a plug in
- How to Rewrite WordPress URL for a Plugin
- Virtual Page with Registration form
- Get URL of Post You Are Editing
- How to Rewrite WordPress URL for a Plugin
- redirect word-press page with page values
- URL rewrite parameter lost (add_rewrite_rule)
- Remove slug of multiple custom post types with and without hierarchical
- Pretty URLs for dynamically created product and pagination pages
- WordPress – Custom permalinks for advanced custom fields (ACF) using post type taxonomy
- Objective Best Practices for Plugin Development? [closed]
- add_menu_page() with different name for first submenu item
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- How to include PHP files in plugins the correct way
- How can I add an image upload field directly to a custom write panel?
- Difference Between Filter and Action Hooks?
- Need help with add_rewrite_rule
- framework for plugin/theme options panel? [closed]
- Creating a table in the admin-style?
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- Settings API with arrays example
- How to get the path to the current theme?
- How to make a plugin require another plugin?
- ajaxurl not defined on front end