{"id":660,"date":"2016-10-11T00:00:00","date_gmt":"2016-10-11T00:00:00","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/uncategorized\/wordpresshow-to-add-facebook-like-button-to-wordpress\/"},"modified":"2026-03-09T19:20:13","modified_gmt":"2026-03-09T19:20:13","slug":"how-to-add-facebook-like-button-to-wordpress","status":"publish","type":"post","link":"\/ng\/tutorials\/how-to-add-facebook-like-button-to-wordpress\/","title":{"rendered":"How to add a Facebook like button in WordPress: coding or a plugin"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Searching for a way to attract more traffic to your WordPress website? Why don&rsquo;t you try Facebook Like buttons? With a click, your visitors can like and share your content on their Facebook accounts.<\/p><p>In this article, we will provide you with a comprehensive tutorial on how to add a Facebook Like button to your WordPress site.<\/p><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-why-do-you-need-a-facebook-like-button-on-your-site\">Why do you need a Facebook Like button on your site?<\/h2><p>You can&rsquo;t deny the power that Facebook holds &ndash; it has over <a href=\"https:\/\/www.statista.com\/statistics\/264810\/number-of-monthly-active-facebook-users-worldwide\/\">3 billion<\/a> monthly active users, and over <a href=\"https:\/\/www.statista.com\/statistics\/778191\/active-facebook-advertisers\/\">ten million<\/a> businesses advertise on this platform.<\/p><p>However, you don&rsquo;t have to use ads to promote your business on Facebook.<\/p><p>Expand your audience reach by using a Facebook Like button. Thanks to the platform&rsquo;s <a href=\"https:\/\/www.optimizesmart.com\/how-to-use-open-graph-protocol\/\">Open Graph<\/a>, your site&rsquo;s link will be posted on a visitor&rsquo;s news feed each time the button is clicked. It&rsquo;s an easy way to get people to share your website.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-add-a-facebook-like-button\">How to add a Facebook Like button<\/h2><p>There are two methods you can use to add a Facebook Like button to your website &ndash; inserting code to your theme&rsquo;s template files or utilizing a <a href=\"\/ng\/tutorials\/what-is-wordpress-plugin\/\">WordPress plugin.<\/a><\/p><h3 class=\"wp-block-heading\" id=\"h-manually-adding-the-code\">Manually adding the code<\/h3><p>Here are the steps to manually add the button to your site:<\/p><ol class=\"wp-block-list\">\n<li>Access the <a href=\"https:\/\/developers.facebook.com\/docs\/plugins\/like-button\/\">Facebook for Developers<\/a> page and click <strong>Like Button Configurator<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"858\" height=\"492\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/facebook-like-button-configurator.png\/public\" alt=\"Facebook Like Button Configurator\" class=\"wp-image-18965\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/facebook-like-button-configurator.png\/w=858,fit=scale-down 858w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/facebook-like-button-configurator.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/facebook-like-button-configurator.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/facebook-like-button-configurator.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><\/figure><\/div><ol start=\"2\" class=\"wp-block-list\">\n<li>Fill out the <strong>URL to Like<\/strong> field with your site&rsquo;s link or the URL of your Facebook page.<\/li>\n\n\n\n<li>Adjust the settings &ndash; width, layout, and size &ndash; to fit your preferences. You&rsquo;ll see how the button looks like inside the preview window.<\/li>\n\n\n\n<li>Click <strong>Get Code<\/strong>, and a popup box will appear.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"714\" height=\"324\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/like-button-code-snippet-e1568385017172.png\/public\" alt=\"Like Button Code Snippet in JavaScript SDK tab\" class=\"wp-image-18966\" style=\"width:714px;height:324px\"><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Copy the first code snippet from the <strong>JavaScript SDK<\/strong> tab.<\/li>\n\n\n\n<li>Open your WordPress dashboard directly or access it from your WordPress web hosting control panel and head over to <strong>Appearance<\/strong> -&gt; <strong>Theme Editor<\/strong>.<\/li>\n\n\n\n<li>Select the<strong> header.php<\/strong> file under the <strong>Theme Files<\/strong>, and paste the code below the &lt;body&gt; tag. Click <strong>Update File<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1165\" height=\"468\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wordpress-theme-editor.png\/public\" alt=\"WordPress Theme Editor, with the Theme Header file highlighted\" class=\"wp-image-18967\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wordpress-theme-editor.png\/w=1165,fit=scale-down 1165w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wordpress-theme-editor.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wordpress-theme-editor.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wordpress-theme-editor.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wordpress-theme-editor.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wordpress-theme-editor.png\/w=990,fit=scale-down 990w\" sizes=\"auto, (max-width: 1165px) 100vw, 1165px\" \/><\/figure><\/div><ol start=\"8\" class=\"wp-block-list\">\n<li>Go back to the<strong> JavaScript SDK<\/strong> tab and copy the second code snippet.<\/li>\n\n\n\n<li>Navigate to <strong>Theme Editor<\/strong> again, and select one of the theme files where you want to display the button. For instance, you can choose <strong>single.php<\/strong>, <strong>page.php<\/strong>, and <strong>footer.php<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Update File<\/strong> and check your website to see the changes.<\/li>\n<\/ol><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-wordpress-hosting\" href=\"\/ng\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"600\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1536,fit=scale-down 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-using-a-plugin\">Using a plugin<\/h3><p>Another way to add Facebook Like button to your site is by using a WordPress plugin.<\/p><p>There are plenty of <a href=\"https:\/\/wordpress.org\/plugins\/tags\/facebook-like-button\/\">plugins<\/a> available, but we recommend using <a href=\"https:\/\/wordpress.org\/plugins\/wp-like-button\/\">WP Like Button<\/a>. It is compatible with all the <a href=\"\/ng\/tutorials\/best-free-wordpress-themes\/\">best WordPress themes<\/a>, provides four different responsive button layouts, and can display a <strong>Share <\/strong>button along with the <strong>Like <\/strong>button.<\/p><p>Here is how you use the plugin:<\/p><ol class=\"wp-block-list\">\n<li>Once you have installed and activated the plugin, open your WordPress dashboard and select <strong>WP Like Button<\/strong> menu.<\/li>\n\n\n\n<li>Use &ldquo;<strong>Where to display?<\/strong>&rdquo; setting to choose where you want the button to be displayed.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"787\" height=\"396\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wp-like-button-settings-e1568385117795.png\/public\" alt=\"WP Like Button WordPress plugin settings\" class=\"wp-image-18968\"><\/figure><\/div><ol class=\"wp-block-list\">\n<li>If you do not want to show the button on particular pages, select the <strong>Exclude specific pages and posts<\/strong>. A dropdown menu will appear where you can pick the posts you want to exclude.<\/li>\n\n\n\n<li>Scroll down to the <strong>Preview<\/strong> section to customize the looks of your button.<\/li>\n\n\n\n<li>Hit <strong>Save Settings<\/strong> &mdash; and you&rsquo;re done.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"344\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wp-like-button-preview-section.png\/public\" alt=\"WP Like Button preview section\" class=\"wp-image-18969\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wp-like-button-preview-section.png\/w=777,fit=scale-down 777w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wp-like-button-preview-section.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wp-like-button-preview-section.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/10\/wp-like-button-preview-section.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 777px) 100vw, 777px\" \/><\/figure><\/div><p>Alternatively, the plugin also allows you to manually add the button by inserting the <span style=\"font-family: 'courier new', courier, monospace\">[fblike]<\/span> shortcode to your WordPress editor.<\/p><p>If you want to disable the <strong>Like<\/strong> button, simply switch the <strong>On\/Off<\/strong> toggle located at the bottom of the settings page.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>All in all, Facebook Like button is an important tool to boost your website traffic. The more readers like and share your content, the bigger the possibility that your website will thrive.<\/p><p>In this tutorial, you&rsquo;ve learned two methods to add Like buttons to your site. The first one requires you to get a certain code from Facebook for Developers, while the other needs you to use a plugin.<\/p><p>Which method do you prefer? Let&rsquo;s discuss it in the comment section below.<\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Learn What Else You Can Do With WordPress                <\/p>\n            <\/div>\n            <p class=\"protip__content\"><a href=\"\/ng\/tutorials\/wordpress\/how-to-login-to-wordpress-dashboard\/\">How to Login to WordPress<\/a><br>\n<a href=\"\/ng\/tutorials\/how-to-duplicate-wordpress-page-or-post\/\">How to Duplicate Pages and Posts on WordPress<\/a><br>\n<a href=\"\/ng\/tutorials\/wordpress\/how-to-delete-wordpress\/\">How to Delete WordPress<\/a><br>\n<a href=\"\/ng\/tutorials\/wordpress-taxonomy\/\">WordPress Taxonomy Guide<\/a><br>\n<a href=\"\/ng\/tutorials\/wordpress-revisions\/\">Guide to WordPress Revisions<\/a><br>\n<a href=\"\/ng\/tutorials\/how-to-add-wordpress-related-posts\/\">How to Add Related Posts in WordPress<\/a><\/p>\n                    <\/div>\n        \n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Searching for a way to attract more traffic to your WordPress website? Why don&rsquo;t you try Facebook Like buttons? With a click, your visitors can like and share your content on their Facebook accounts. In this article, we will provide you with a comprehensive tutorial on how to add a Facebook Like button to your [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/how-to-add-facebook-like-button-to-wordpress\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":37,"featured_media":145430,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"2 Ways to Add Facebook Like Button in WordPress: Step-by-Step","rank_math_description":"Want to attract more traffic to your website? Check out our comprehensive guide on how to add Facebook Like button to your WordPress site.","rank_math_focus_keyword":"facebook like button in wordpress","footnotes":""},"categories":[22637],"tags":[],"class_list":["post-660","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-add-facebook-like-button-to-wordpress","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-add-facebook-like-button-to-wordpress","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-add-facebook-like-button-to-wordpress","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-add-facebook-like-button-to-wordpress","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-add-facebook-like-button-to-wordpress","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-add-facebook-like-button-to-wordpress","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-add-facebook-like-button-to-wordpress","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-add-facebook-like-button-to-wordpress","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/660","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/37"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=660"}],"version-history":[{"count":21,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/660\/revisions"}],"predecessor-version":[{"id":145429,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/660\/revisions\/145429"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media\/145430"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}