WP error undefined variable
-
Version: 2.4.7 (local).
php 8.3
I get this error message : [24-Dec-2025 11:16:44 UTC] PHP Warning: Undefined variable $link in …broken-link-checker/legacy/includes/any-post.php on line 610
Analysis of Claude:
Found it! The
$linkvariable is only set inside theif/elseifconditions. If none match,$linkis undefined on line 610.Fix: Initialize
$linkbefore the conditions:$post_type_object = get_post_type_object( $post->post_type );
if ( ! $post_type_object ) {
return '';
}
if ( 'wp_template' === $post->post_type || 'wp_template_part' === $post->post_type ) {
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.