The default URI is not stored anywhere, it is just generated dynamically in the admin interface. If the Default URI is recognized, it means that they are identical to the native/original permalinks.
Could you try to access a sample product category using its Default URI if Permalink Manager is deactivated?
Edit:
If you would like to force “404” on Default URI product category pages you will need to use an additional code snippet:
function pm_force_404_on_native_permalinks() {
global $wp_query, $pm_query;
// 1. Get the queried object
$object = get_queried_object();
// 2. Use it only if no custom permalink is detected
if(!empty($pm_query['id'])) { return; }
// 3. Use it only for product categories
if(empty($object->taxonomy) || $object->taxonomy !== 'product_cat') { return; }
// 4. Force "404" error page
$wp_query->query = $wp_query->queried_object = $wp_query->queried_object_id = null;
$wp_query->set_404();
status_header(404);
nocache_headers();
$pm_query = '';
}
add_action('wp', 'pm_force_404_on_native_permalinks', 5);
Please paste it to functions.php file in your child theme directory.
-
This reply was modified 3 years, 1 month ago by Maciej Bis.