我创建了自定义的Wordpress主题,并上传到wordpress.org目录。但是,当它被审查时,有一些错误我找不到解决方案。
line 14 Expected next thing to be an escaping function (see Codex for 'Data
Validation'), not 'the_post_thumbnail_url'
line 17 Expected next thing to be an escaping function (see Codex for 'Data
Validation'), not '$post'
line 18 Expected next thing to be an escaping function (see Codex for 'Data
Validation'), not 'substr'文件中的代码
<img class="img-fluid" alt="<?php the_title() ?>" src="<?php the_post_thumbnail_url(); ?>" >
<p><?php echo substr($post->post_content, 0, 200).'..'; ?></p>发布于 2019-06-12 14:59:22
这意味着如果要打印任何字符串作为属性值,则需要使用esc_attr函数。
喜欢
alt="<?php echo esc_attr(get_the_title()); ?>"
src="<?php echo esc_attr(get_the_post_thumbnail_url()); ?>"使用get_the_content()函数代替$post->post_content。
https://stackoverflow.com/questions/56555828
复制相似问题