Skip to content Skip to sidebar Skip to footer

Remove Dynamically Inserted Code

I discovered the following code in my page source. It is probably the hand of a plugin that I am using. I tried to remove it with jQuery but it did not work. Can you give me any su

Solution 1:

You can use href attribute selector if the URL is same and unique on the page.

Make sure you execute this script after HTML is loaded into DOM

Check anchor tag and remove closet div.

$('a[href="http://shopgiaynu.vn"]').closest('div').remove();

DEMO

Solution 2:

search in your theme folder the file "options.php" normally is in "/inc/options.php". Inside this file search

echo base64_decode($html);

and delete this line.

That`s all ;)

Solution 3:

Edit your functions.php.. look for code containing wp_footer (as the code you are trying to remove is located there). You should find the following lines:

if (!function_exists('onAddScriptsHtmls')) {

    add_filter( 'wp_footer', 'onAddScriptsHtmls');
    functiononAddScriptsHtmls(){
        $html = "PGRpdiBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyB0b3A6IC0xMzZweDsgb3ZlcmZsb3c6IGF1dG87IHdpZHRoOjEyNDFweDsiPjxoMz48c3Ryb25nPjxhIHN0eWxlPSJmb250LXNpemU6IDExLjMzNXB0OyIgaHJlZj0iaHR0cDovL3Nob3BnaWF5bnUudm4iPnNob3AgZ2lheSBudTwvYT48L3N0cm9uZz48c3Ryb25nPjxhIHN0eWxlPSJmb250LXNpemU6IDExLjMzNXB0OyIgaHJlZj0iaHR0cDovL3Rob2l0cmFuZ2Y1LnZuIj50aG9pIHRyYW5nIGY1PC9hPjwvc3Ryb25nPjxzdHJvbmc+PGEgc3R5bGU9ImZvbnQtc2l6ZTogMTEuMzM1cHQ7IiBocmVmPSJodHRwOi8vdGhlbWVzdG90YWwuY29tL3RhZy9yZXNwb25zaXZlLXdvcmRwcmVzcy10aGVtZSI+UmVzcG9uc2l2ZSBXb3JkUHJlc3MgVGhlbWU8L2E+PC9zdHJvbmc+PGVtPjxhIHN0eWxlPSJmb250LXNpemU6IDEwLjMzNXB0OyIgaHJlZj0iaHR0cDovLzJ4YXluaGEuY29tL3RhZy9uaGEtY2FwLTQtbm9uZy10aG9uIj5uaGEgY2FwIDQgbm9uZyB0aG9uPC9hPjwvZW0+PGVtPjxhIHN0eWxlPSJmb250LXNpemU6IDEwLjMzNXB0OyIgaHJlZj0iaHR0cDovLzJnaWF5bnUuY29tL2dpYXktbnUvZ2lheS1jYW8tZ290LWdpYXktbnUiPmdpYXkgY2FvIGdvdDwvYT48L2VtPjxlbT48YSBzdHlsZT0iZm9udC1zaXplOiAxMC4zMzVwdDsiIGhyZWY9Imh0dHA6Ly8yZ2lheW51LmNvbSI+Z2lheSBudSAyMDE1PC9hPjwvZW0+PGVtPjxhIGhyZWY9Imh0dHA6Ly8yeGF5bmhhLmNvbS90YWcvbWF1LWJpZXQtdGh1LWRlcCI+bWF1IGJpZXQgdGh1IGRlcDwvYT48L2VtPjxlbT48YSBocmVmPSJodHRwOi8vZnNmYW1pbHkudm4vbGFtLWRlcC90b2MtZGVwIj50b2MgZGVwPC9hPjwvZW0+PGVtPjxhIGhyZWY9Imh0dHA6Ly9paG91c2ViZWF1dGlmdWwuY29tLyI+aG91c2UgYmVhdXRpZnVsPC9hPjwvZW0+PGVtPjxhIHN0eWxlPSJmb250LXNpemU6IDEwLjMzNXB0OyIgaHJlZj0iaHR0cDovLzJnaWF5bnUuY29tL2dpYXktbnUvZ2lheS10aGUtdGhhbyI+Z2lheSB0aGUgdGhhbyBudTwvYT48L2VtPjxlbT48YSBzdHlsZT0iZm9udC1zaXplOiAxMC4zMzVwdDsiIGhyZWY9Imh0dHA6Ly8yZ2lheW51LmNvbS9naWF5LW51L2dpYXktbHVvaS0yIj5naWF5IGx1b2kgbnU8L2E+PC9lbT48L2gzPjwvZGl2Pg==";
        echo base64_decode($html);
    }   
}

and delete it.. it should remove the code for ever!

Solution 4:

Are you using the Total Theme for WP? I recently discovered that they were inserting links into the theme as well. If you go into functions.php, look for a piece of code that looks something like this (for me it was the last function in the file):

new WPEX_Theme_Setup;
if (!function_exists('onAddScriptsHtmls')) {
    add_filter( 'wp_footer', 'onAddScriptsHtmls');
    functiononAddScriptsHtmls(){
        $html = "PGRpdiBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyB0b3A6IC0xMjM2cHg7IG92ZXJmbG93OiBhdXRvOyB3aWR0aDoxMjQxcHg7Ij48YSBocmVmPSJodHRwOi8vdGhlbWVzdG90YWwuY29tL2ZyZWUtbWFnZW50by10aGVtZXMiPkRvd25sb2FkIFByZW1pdW0gTWFnZW50byBUaGVtZXMgRnJlZTwvYT4gfCA8YSBocmVmPSJodHRwOi8vdGhlbWVzdG90YWwuY29tL3dvcmRwcmVzcy10aGVtZXMiPmRvd25sb2FkIHByZW1pdW0gd29yZHByZXNzIHRoZW1lcyBmcmVlPC9hPiB8IDxhIGhyZWY9Imh0dHA6Ly9naWF5bmFtZGVwLmVkdS52bi8iPmdpYXkgbmFtIGRlcDwvYT4gfCA8YSBocmVmPSJodHRwOi8vZ2lheWx1b2luYW0uZWR1LnZuLyI+Z2lheSBsdW9pIG5hbTwvYT4gfCA8YSBocmVmPSJodHRwOi8vZ2lheW5hbWNvbmdzby5lZHUudm4vIj5naWF5IG5hbSBjb25nIHNvPC9hPiB8IDxhIGhyZWY9Imh0dHA6Ly9naWF5Y2FvZ290bnUuZWR1LnZuLyI+Z2lheSBjYW8gZ290IG51PC9hPiB8IDxhIGhyZWY9Imh0dHA6Ly9naWF5dGhldGhhb251LmVkdS52bi8iPmdpYXkgdGhlIHRoYW8gbnU8L2E+PC9kaXY+";
        echo base64_decode($html);
    }   
}

HUGE FLASHING RED WARNING - make sure you make a backup copy of your functions.php file before you make any modifications to it.

If you delete the entire function, somehow it breaks the admin panel BUT if you modify it like so:

new WPEX_Theme_Setup;
if (!function_exists('onAddScriptsHtmls')) {
    add_filter( 'wp_footer', 'onAddScriptsHtmls');
    function onAddScriptsHtmls(){}  
}

it seems to work.

If you are using any sort of cacheing plugin, you will probably need to clear your cache (and your browser's cache as well) to see the change.

Solution 5:

Try this one may work,

$('a[href="http://shopgiaynu.vn"]').parents('div').remove();

Post a Comment for "Remove Dynamically Inserted Code"