Page 1 of 1
Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 2:49 am
by simonmlewis
We have using Blogger Import Extended to import a Blog site to Wordpress.
It took hours. But now on each blog we are seeing this code:
[text]var a2a_config = a2a_config || {};
a2a_config.linkurl = "
www.sitename.blogspot.com";[/text]
With "sitename" being the name of the blogspot.
Any ideas what it might be? I've looked it up and there is some sort of "addtoany" script, but I don't want that to be there, because we are moving the site away from blogspot.
The only other thing I can think of, is to look it up int he database, see how it is shown, and do a replace all of that for nothing.
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 6:40 am
by Celauran
If this is saved in the post content in the database, then yeah, large scale find and replace is probably the fastest option.
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 7:08 am
by simonmlewis
Damn thing has variants. I did try that, but it removed the odd one.
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 7:19 am
by simonmlewis
If I did a search for it, it found it if I just searched for a portion of it. But because maybe one has a space, or something like that, it just finds 1, 2 and that's it. Not all of them.
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 7:57 am
by Celauran
Having only the two lines above to go on, couldn't you simply remove any line containing 'a2a_' ?
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 8:39 am
by simonmlewis
No, because that is a 2% portion of what's in the Post.
Think of it like a big Blog site. maybe 200-300 words, and that tiny portion in the head or the base of the code that's in the DB.
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 8:47 am
by Celauran
Right, that's how I was thinking of it, but your example showed them each on their own line. If that's not the case, maybe you need to look at building a regex to match those segments.
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 8:52 am
by simonmlewis
Sorry how do you mean? I want to remove them from the DB, as this is a Wordpress site, and dont' want to mess up the Post pages.
Bizarrely, when you run a query for how many have the full code, it's around 588, but when you do a Replace, it finds 1 or 2. How is that possible?
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 8:56 am
by simonmlewis
Code: Select all
SELECT * FROM `wp_posts` WHERE post_content LIKE '%var a2a_config = a2a_config || {};
a2a_config.linkurl = "www.site.blogspot.com";%'
UPDATE wp_posts
SET post_content = REPLACE(post_content, 'var a2a_config = a2a_config || {};
a2a_config.linkurl = "www.site.blogspot.com";', '')
The top one finds over 580 entries.
The second script replaces just 8! How is that possible???
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 8:58 am
by Celauran
simonmlewis wrote:this is a Wordpress site, and dont' want to mess up the Post pages.
WP isn't really relevant here. You have a DB table with some contents you need to alter.
simonmlewis wrote:Bizarrely, when you run a query for how many have the full code, it's around 588, but when you do a Replace, it finds 1 or 2. How is that possible?
I don't really have enough information to answer that.
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 9:02 am
by simonmlewis
I thought you meant use that code in the page. I want to remove them from the database tables.
A post_content field might contain something like this:
Code: Select all
var a2a_config = a2a_config || {};
a2a_config.linkurl = "www.website.blogspot.com";
Having just returned from my first skiing holiday I am now belatedly aware how family-friendly the sport is and how, if children learn early, you can look forward to many happy hours on the slopes in future years. <br />
<br />
If youcontent content bla bla
<b><i><br /></i></b>
<b><i><br /></i></b>
I need shot of that var..... "; text. They are all the same, but oddly, as I said, doing a SELECT finds them all. Doing a REPLACE, doesn't.
Re: Blogger Import - odd a2a {} code now showing
Posted: Thu Apr 07, 2016 9:06 am
by Celauran
Might be easiest at this point to pull the pages down, fix them in PHP, either by removing those lines -- they do appear to be on separate lines in this example -- or with regex, and then writing the results back to the DB.