skip to content
Site header image Nerdy Momo Cat

Want to Unlike All Liked Pages on Facebook?


I have been wanting to unlike all pages on Facebook that I liked as a teen in 2010. Because I stopped using Facebook pretty early (around 2014) — I thought unliking all of them made perfect sense. I did find some extensions to do so, that are now defunct; and 2 console tricks, that no longer work because Facebook keeps changing it layouts.

That is, until I landed on this comment on a gist.

Long story short; log into Facebook, open this link, install TamperMonkey if you don’t have it, paste and save the code below as user script, refresh that page and let it run. This uses the activity log to unlike pages, so when you go to your likes; there might still be brands that you ned to go to pages of and unlike and unfollow manually. The reload built into the script is required because after a few iterations, Facebook stops loading your earlier activity unless you refresh the page.

// ==UserScript==
// @name         Facebook Auto Unlike
// @namespace    http://tampermonkey.net/
// @version      2024-04-24
// @description  Automatically unlikes posts on Facebook
// @author       You
// @match        https://www.facebook.com/usrID/allactivity?activity_history=false&category_key=LIKEDINTERESTS&manage_mode=false&should_load_landing_page=false
// @icon         https://www.google.com/s2/favicons?sz=64&domain=facebook.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function runAutomation() {
        setTimeout(() => {
            const options = [].slice.call(document.querySelectorAll('[aria-label="Action options"]'));
            options.forEach(option => option.click());

            setTimeout(() => {
                const menuItems = [].slice.call(document.querySelectorAll('[role="menuitem"]'));
                const unlikeItems = menuItems.filter(item => item.innerText.includes('Unlike'));
                unlikeItems.forEach(item => item.click());

                setTimeout(() => {
                    location.reload();
                }, 3000); // 10 seconds after clicking unlike

            }, 3000); // 5 seconds after clicking action options

        }, 3000); // Start 5 seconds after page load
    }

    // Run the automation function when the page loads
    window.addEventListener('load', runAutomation);
})();