get_option( 'permalink_structure' )
is your friend. If you’re using the default it will be set as an empty string:
if( get_option( 'permalink_structure' ) !== '' ) {
// custom permalink enabled code
} else {
// no permalink
}
Related Posts:
- What is the difference between get_post_permalink and get_permalink?
- WordPress matching URLs with trailing tildes
- Rewrite Rule for Multilingual Website, Like qTranslate?
- How to use relative links on my pages?
- How to filter to output of the get_permalink() function
- Change slug on post creation
- WordPress Permalink changes to question mark (?) in URL
- Is there a user-facing interface to edit an attachment’s permalink?
- Can WordPress realistically handle a site with 500 ‘pages’?
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- Get post title with link
- WooCommerce permalinks [closed]
- Menu Link Redirect Based on Username or User ID
- Redirect short-form URL to long-form URL (post_id to post_id + post_name)
- Maintaining two permalink structures
- Enable Minify in W3Total Cache using NGINX [closed]
- Can’t change permalink url after hitting ‘ok’ and ‘update’
- Rewrite user profile URL to be human friendly
- removing index.php IIS 7.5 webconfig
- Why I can’t change the permalink of this page?
- Sub-category and category in permalink structure
- Permalinks changed with WordPress 4.9
- Permalinks broken regularly
- 404 Page Not Found for Only One Post
- How to 301 all posts
- Call to a member function add_rule() on a non-object
- Link to blog index from template
- How to change Post ID during import
- How can I add a page’s ID to its permalink using WP_Rewrite?
- Debugging permalink issue
- WordPress 404 in development area
- Changing post content on save, using updated fields
- Change blog segment of URL
- Change in permalink structure made javascript cookie not work correctly
- why some permalinks adding characters/ruining links
- How to find the post_id of a post on a wordpress blog that uses pretty URLs?
- Redirects after permalink change
- WordPress permalink setup in Hindi
- WPML Permalink missing language slug
- How to remove /year/month from uploaded medias?
- Use custom post meta in permalink
- SEO: shortening permalinks to five words
- Remove -2 from URL; no duplicate pages, no images, no pages in trash
- Htaccess https 301 problem
- Add sku to product url woocommerce [closed]
- Press-This stopped redirecting to permalink after post publish
- Giving a new page an existing URL
- When do i need to get permalink structure of a specific post?
- implement separate templates for 1 post type
- encoded search terms with %20
- Permalinks not working on new site
- Adding URL prefix for foreign language support
- Custom links in menus not working in multiple environments
- Remove all stop words from old permalinks
- 404 error on all pages but custom post types are working OK
- using wp_redirect to redirect to a permalink
- old permalinks not found
- WordPress permalink from the database?
- How can I see a list of all pages my WordPress site has generated?
- Can I change the URL structure for a CPT only?
- Display parent page URL for child page
- How to set add_query_arg properly for home page?
- How to redirect old permalinks from https://exmaple.com/category/post_id to https://exmaple.com/category/post_id.html
- Double Slash After Media Path (uploads//)
- Make a post inaccessible without a unique ID in the URL
- Undefined variable: testimonial in D:\Projects\PWP-WP\wp-content\themes\blankslate-child\template-parts\fields\flex\bottom-page-block.php on line 123
- Is it possible to set public to false for the native WordPress blog
- Code snippet to add filter pre_post_link to change Media URL (post_type attachment permalink/slug)
- Change permalink structure in all sites of a multisite
- Custom Permalink (with category) for Pages
- Changing permalink stops me from creating webpages
- Make query parameter an endpoint
- WP adding noopener and noreferrer to all links
- 301 redirects after changing permalinks
- Rename Custom Post Slug using taxonomy
- Link works although page was moved to another location
- Added a prefix in URL permalink structure but the old structure still working!
- Permalink of post redirect to uncategorized category
- Getting current page URL when default permalink is set
- WordPress All pages but home simply read “hello”
- Force/Limit the post/page slug to accept only url friendly characters
- Make Permalinks have a custom format?
- Permalinks setting raises 500.0 error
- permalinks of subcategory and posts
- Fresh wordpress installation in sub-directory not accessible
- Define a Permalink Structure by Post and Page
- WordPress 4.0 beta – how to change the link URL in RSS feeds
- After changing permalink settings, everything works fine except for the two most recent posts
- Installing WordPress in another Install?
- using post meta data as permalink tags [duplicate]
- How to display post permalinks instead of pages?
- .htaccess not working in WordPress
- Incorporate single WordPress page into an existing static website [duplicate]
- How to configure WordPress to be a subdirectory of my main site as mymainsite.com/blog?
- How to avoid duplicate Url for the home page
- Removing parent page in URL for one page
- Remove index.php from URL
- htaccess strip url
- My permalinks no longer have the “news” category prefix in the link and it’s causing 404 errors for articles published on the web