syntax error, unexpected ‘$id’ (T_VARIABLE) – where is the issue though?

This function below throws the following error: “syntax error, unexpected ‘$id’ (T_VARIABLE)”

This function and question is related to this post.

function so328323_prefix_title( $title, $id = null ) {

if ( get_post_type $id ) == ‘tools-in-2019’ {
$title = “123 ” . $title;
}

return $title;
}
add_filter( ‘the_title’, ‘so328323_prefix_title’, 10, 2 );

Read more here:: syntax error, unexpected ‘$id’ (T_VARIABLE) – where is the issue though?

Leave a Reply

Your email address will not be published. Required fields are marked *