您正在使用$post_id, 但您已通过post ID作为$postID. 因此$a 始终为空。
即使它不是空的,也没有PHP函数srtpos. 它是strpos 您可以执行更直接的逻辑set_post_format.
包装:
function CambiarPostFormat( $postID ) {
$a = get_the_title( $postID );
if ( !has_post_format( \'image\', $postID ) && strpos($a, \'imagenes\') !== false)
set_post_format( $postID, \'image\' );
}