fix(wpmc 1.1.0): review polish — continue on bad permalink, ACF guard, drop suppress_filters, process-isolated AJAX test
tests / phpunit (push) Has been cancelled
tests / phpunit (push) Has been cancelled
- Redirect::handle: continue instead of return when get_permalink fails on a row (allow trying next row)
- Helpers::acf_ready() now public so Redirect can guard get_field('page_unic', ...) consistently
- Drop suppress_filters=false from get_posts (was risky on sites with query-altering plugins)
- @runInSeparateProcess for DOING_AJAX test (replaces Z-prefix ordering hack)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -30,12 +30,11 @@ final class Redirect
|
||||
}
|
||||
|
||||
$candidates = \get_posts([
|
||||
'name' => $slug,
|
||||
'post_type' => 'page',
|
||||
'post_status' => ['private', 'publish'],
|
||||
'posts_per_page' => 1,
|
||||
'no_found_rows' => true,
|
||||
'suppress_filters' => false,
|
||||
'name' => $slug,
|
||||
'post_type' => 'page',
|
||||
'post_status' => ['private', 'publish'],
|
||||
'posts_per_page' => 1,
|
||||
'no_found_rows' => true,
|
||||
]);
|
||||
if (empty($candidates)) {
|
||||
return;
|
||||
@@ -43,7 +42,7 @@ final class Redirect
|
||||
|
||||
$candidate_id = (int) $candidates[0]->ID;
|
||||
|
||||
if (!\function_exists('get_field')) {
|
||||
if (!Helpers::acf_ready() || !\function_exists('get_field')) {
|
||||
return;
|
||||
}
|
||||
$rows = \get_field('page_unic', 'option');
|
||||
@@ -71,7 +70,7 @@ final class Redirect
|
||||
static fn () => \get_permalink($orig_id)
|
||||
);
|
||||
if (!is_string($orig_permalink) || $orig_permalink === '') {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
$path_only = Helpers::remove_domain_link($orig_permalink);
|
||||
$redirect_to = '/' . $term->slug . $path_only;
|
||||
|
||||
Reference in New Issue
Block a user