
{"id":5432,"date":"2016-07-14T01:13:15","date_gmt":"2016-07-14T01:13:15","guid":{"rendered":"http:\/\/tapchicntt.com\/?p=5432"},"modified":"2025-04-15T13:51:14","modified_gmt":"2025-04-15T06:51:14","slug":"wordpress-xoa-thuoc-tinh-width-va-height-khi-chen-vao-bai-viet","status":"publish","type":"post","link":"https:\/\/tapchicntt.com\/wordpress-xoa-thuoc-tinh-width-va-height-khi-chen-vao-bai-viet\/","title":{"rendered":"[WordPress] X\u00f3a thu\u1ed9c t\u00ednh width v\u00e0 height khi ch\u00e8n v\u00e0o b\u00e0i vi\u1ebft"},"content":{"rendered":"\n<p>Ch\u00e0o c\u00e1c b\u1ea1n, trong WordPress khi b\u1ea1n t\u1ea3i h\u00ecnh \u1ea3nh v\u00e0 ch\u00e8n n\u00f3 v\u00e0o b\u00e0i vi\u1ebft, n\u00f3 s\u1ebd bao g\u1ed3m thu\u1ed9c t\u00ednh width v\u00e0 height trong th\u1ebb html <code><strong>&lt;img><\/strong><\/code><\/p>\n\n\n\n<p>N\u1ebfu b\u1ea1n \u0111\u0103ng m\u1ed9t h\u00ecnh qu\u00e1 l\u1edbn, c\u00e1c thu\u1ed9c t\u00ednh &#8220;<strong>width<\/strong>&#8221; v\u00e0 &#8220;<strong>height<\/strong>&#8221; s\u1ebd ph\u00e1 v\u1ee1 layout c\u1ee7a website b\u1ea1n.<\/p>\n\n\n\n<p>Sau \u0111\u00e2y ch\u00fang t\u00f4i s\u1ebd h\u01b0\u1edbng d\u1eabn c\u00e1c b\u1ea1n c\u00e1ch x\u00f3a b\u1ecf thu\u1ed9c t\u00ednh <strong>width<\/strong> v\u00e0 <strong>height<\/strong>.<\/p>\n\n\n\n<p>M\u1edf file <strong><code>functions.php<\/code><\/strong> trong th\u01b0 m\u1ee5c themes b\u1ea1n \u0111ang s\u1eed d\u1ee5ng v\u00e0 ch\u00e8n \u0111o\u1ea1n code sau v\u00e0o:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nadd_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );\nadd_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );\n\nfunction remove_width_attribute( $html ) {\n    $html = preg_replace( '\/(width|height)=\\\"\\d*\\\"\\s\/', \"\", $html );\n    return $html;\n}\n<\/pre><\/div>\n\n\n<p>L\u01b0u l\u1ea1i.<\/p>\n\n\n\n<p>L\u1ea7n sau khi b\u1ea1n ch\u00e8n h\u00ecnh \u1ea3nh v\u00e0o th\u00ec WordPress s\u1ebd t\u1ef1 \u0111\u1ed9ng x\u00f3a thu\u1ed9c t\u00ednh <strong>width<\/strong> v\u00e0 <strong>height<\/strong>.<\/p>\n\n\n\n<p>Ch\u00fac c\u00e1c b\u1ea1n th\u00e0nh c\u00f4ng!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ch\u00e0o c\u00e1c b\u1ea1n, trong WordPress khi b\u1ea1n t\u1ea3i h\u00ecnh \u1ea3nh v\u00e0 ch\u00e8n n\u00f3 v\u00e0o b\u00e0i vi\u1ebft, n\u00f3 s\u1ebd bao g\u1ed3m [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":6979,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[143],"tags":[],"class_list":["post-5432","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thu-thuat-wordpress"],"views":577,"_links":{"self":[{"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/posts\/5432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/comments?post=5432"}],"version-history":[{"count":1,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/posts\/5432\/revisions"}],"predecessor-version":[{"id":9729,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/posts\/5432\/revisions\/9729"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/media\/6979"}],"wp:attachment":[{"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/media?parent=5432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/categories?post=5432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tapchicntt.com\/rest-api\/wp\/v2\/tags?post=5432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}