social sharing - How to escape echo?

I have just added few social media icons to share the current post. So the code is below for pinterest (example purpose)

I have just added few social media icons to share the current post. So the code is below for pinterest (example purpose). But the reviewer said echo should be escaped.

Why the reviewer pointed it to escape the "echo" and what is the way to do so...

<!-- pinterest -->
<a href="/?media=<?php echo get_the_post_thumbnail_url(); ?>&url=<?php echo get_permalink(); ?>&is_video=false&description=<?php echo get_the_title(); ?>" target="blank"><i class="fab fa-pinterest-square"></i></a>

I have just added few social media icons to share the current post. So the code is below for pinterest (example purpose). But the reviewer said echo should be escaped.

Why the reviewer pointed it to escape the "echo" and what is the way to do so...

<!-- pinterest -->
<a href="https://pinterest/pin/create/bookmarklet/?media=<?php echo get_the_post_thumbnail_url(); ?>&url=<?php echo get_permalink(); ?>&is_video=false&description=<?php echo get_the_title(); ?>" target="blank"><i class="fab fa-pinterest-square"></i></a>
Share Improve this question asked Jan 6, 2020 at 5:10 webfuelcodewebfuelcode 212 bronze badges
Add a comment  | 

1 Answer 1

Reset to default -1

Do not use echo because WordPress has already defined it. So use it as given below:

<?php the_post_thumbnail(); ?>
<?php the_permalink(); ?>
<?php the_title(); ?>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744850092a4597074.html

相关推荐

  • social sharing - How to escape echo?

    I have just added few social media icons to share the current post. So the code is below for pinterest (example purpose)

    2天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信