The iis7_supports_permalinks WordPress PHP Filter allows you to modify whether IIS 7+ supports pretty permalinks or not.
Usage
add_filter('iis7_supports_permalinks', 'your_custom_function'); function your_custom_function($supports_permalinks) { // your custom code here return $supports_permalinks; }
Parameters
$supports_permalinks
(bool): Whether IIS7 supports permalinks. Default isfalse
.
More information
See WordPress Developer Resources: iis7_supports_permalinks
Examples
Enable pretty permalinks on IIS7
Enable support for pretty permalinks on IIS7 by returning true
:
add_filter('iis7_supports_permalinks', 'enable_iis7_pretty_permalinks'); function enable_iis7_pretty_permalinks($supports_permalinks) { return true; }
Disable pretty permalinks on IIS7
Disable support for pretty permalinks on IIS7 by returning false
:
add_filter('iis7_supports_permalinks', 'disable_iis7_pretty_permalinks'); function disable_iis7_pretty_permalinks($supports_permalinks) { return false; }
Enable pretty permalinks based on a condition
Enable pretty permalinks only if a specific condition is met:
add_filter('iis7_supports_permalinks', 'conditionally_enable_iis7_pretty_permalinks'); function conditionally_enable_iis7_pretty_permalinks($supports_permalinks) { if (your_condition_here) { return true; } return $supports_permalinks; }
Modify support for pretty permalinks based on the user role
Enable pretty permalinks for administrators and disable for other users:
add_filter('iis7_supports_permalinks', 'modify_iis7_pretty_permalinks_based_on_user_role'); function modify_iis7_pretty_permalinks_based_on_user_role($supports_permalinks) { if (current_user_can('administrator')) { return true; } return false; }
Enable pretty permalinks only for a specific post type
Enable pretty permalinks only for a specific custom post type:
add_filter('iis7_supports_permalinks', 'enable_iis7_pretty_permalinks_for_custom_post_type'); function enable_iis7_pretty_permalinks_for_custom_post_type($supports_permalinks) { if (get_post_type() == 'your_custom_post_type') { return true; } return $supports_permalinks; }