After migrating WP site from http to https Facebook Like Counts lost on several posts but not on all? - http

I have a weird problem.
Two weeks ago I migrated my Wordpress sites from http to https.
I used the Really Simple SSl plugin to get it all secure: https://wordpress.org/plugins/really-simple-ssl/
That worked great.
But after the migration I saw I lost all my FB like counts.
I found the solution I thought in this article: https://really-simple-ssl.com/knowledge-base/how-to-recover-facebook-likes-after-moving-to-httpsssl/
It is from the same author as the Really Simple SSL plugin.
I put the code in the functions.php from my theme. But soon I found out, that on some posts the counts were restored, but on other postst the counts are zero: https://www.tina-turner.nl/blog/page/11/
I have 3 websites and on 1 of them it works alright.
But on the other 2 sites I have the problem. I started with deactivating all plugins and also changed the theme, but that didn't solve the problem.
I searched the internet, but can't find a solution for this problem.
The one thing I didn't try yet is to buy the Really Simple Social plugin from this same author. He says maybe when I activate the og: url in that plugin it might work. https://really-simple-ssl.com/downloads/really-simple-ssl-social/
But first I am trying to achieve this without buying anything.
I tried some code.
The original code in the functions.php is this:
// Recover FB Counts
function rsssl_exclude_http_url($html) {
//replace the https url back to http
$html = str_replace('data-href="https://www.tina-turner.nl/blog', 'data-href="http://www.tina-turner.nl/blog', $html); return $html;
}
add_filter("rsssl_fixer_output","rsssl_exclude_http_url");
I tried to add some code for the og: url, but I am not good with code.
This is what I tried and that didn't work:
// Recover FB Counts
function rsssl_exclude_http_url($html) {
$html = preg_replace('~<meta property="og:url" content="https://~', '<meta property="og:url" content="http://', $html, 1);
$html = str_replace('data-href="https://www.tina-turner.nl/blog', 'data-href="http://www.tina-turner.nl/blog', $html);
return $html;
}
add_filter("rsssl_fixer_output","rsssl_exclude_http_url");
That filter is necessary, since the Really Simple SSl plugin sets everything from http to https.
Oh and to be complete, I use the Add to Any plugin for the FB Like button.
Can somebody help me with this?
Johanna

Related

Wordpress "Dynamic Featured Image": blank slider/gallery with HTTPS admin panel

I'm using "Dynamic Featured Image" to create a gallery inside a custom post.
All worked fine until I decided to buy and enable an SSL certificate for my Wordpress site. From that moment on, all the new galleries/image-sliders created displays nothing, blank, but all the old ones keep going just fine. If I disable the HTTPS on admin side, dis-link the images from the post and re-link them all, everything works.
It seems there's something wrong going on when the path of images is an https one. I'm running out of ideas. Anyone has some tips for me?
P.S.
I tried to apply this function to the plugins url request but had no luck.
function de_https ($url) {
$url = preg_replace("/^https:/i", "http:", $url);
return $url;
}
This issue was fixed in ver3.1.13.

Wordpress Job Manager Pagination Issue

I am using the Wordpress Jobs Manager plugin. It all works great except the pagination feature. When enabled, the pagination buttons just redirect the user to the homepage instead of to the paginated page of results. As far as i can tell this is a problem with permalinks but i wondered if anyone had a workaround as i cannot use the standard permalinks on my site.
Does anyone know of any possible fixes? Its a custom built theme.
Thanks for you help guys
I know its a long time since you posted, but i had this issue today and came across your post.
I did some investigating and found it to be a problem with the way wordpress was dealing with the rewrites for canonical redirects.
I did a search on the internet and found the following post on wordpress.stackexchange.com by Celine Garel which deals with this situation for custom post types, i just changed it to work with a page.
https://wordpress.stackexchange.com/questions/134339/pagination-on-custom-post-type-not-working-if-permalinks-set-to-rewrite-url
Add this to your themes function file,
add_filter( 'redirect_canonical','custom_disable_redirect_canonical' );
function custom_disable_redirect_canonical( $redirect_url ){
if ( is_page('Your_job_list_page') ) $redirect_url = false;
return $redirect_url;
}
This fixed it for me. Hope it helps you or anybody else.

Wordpress: On specific url the admin toolbar shows up (Even when not logged in)

I'm running into a Major trouble.
Today I found out that when visiting a specific URL on my website, the admin toolbar shows up. Also for people who are not logged in. It appears that the visitor is logged in, but that's not true. All the links in the toolbar go to a 404 page. However, important information is being shown, like how many plugins need an update and even my login name.
Is anyone familiar with this?
Since it is a corporate website, I need a fix as soon as possible.
(due to security reasons I won't post the exact url in public)
Hopefully anyone can help me.
Thanks,
Stefan
Try to add either of these code in functions.php of your theme,
Code 1:
<?php
add_filter('show_admin_bar', '__return_false');
?>
Code 2:
function hide_admin_bar_from_front_end(){
remove_action( 'wp_head', '_admin_bar_bump_cb' );
return false;
}
add_filter( 'show_admin_bar', 'hide_admin_bar_from_front_end' );

Google Indexing Non-Existent URLs. WordPress Doesn't Show 404

I was inspecting the Google search results for: "site:mywordpress.org." And found lots or pages indexed that shouldn't exist.
There are two problems here:
I don't know how Google located, crawled, or found these URLs.
Wordpress doesn't show a 404 error, so it looks like duplicate content.
I tried the Wordpress support forums, but no one responded. I also have not been able to find anyone reporting this problem. Here's an example of what I am seeing:
mywordpress.org/blog-post/
mywordpress.org/blog-post/1363035032000/
I've added a canonical link reference to the head and I've been doing lots of Google WMT removal requests, but I'm still seeing some results like this.
I've tested this on a few wordpress installs, it seems that if you add any string of numbers to the end of a permalink it will still display the content rather than showing a 404 error.
I also noticed that the number that is being added to the permalinks is the UNIX time stamp with a few zeros on the end. As of this post the current UNIX time stamp is: 1363035971.
I'm looking for some advice on what I should do. I'm particularly interested in a PHP function that would check the url to see if there was a string of numbers at the end, and if there was, 301 redirect it to the right permalink. I'd also value any input on why Google is finding these wrong urls and if the UNIX time stamp is the clue.
Did you check if some plugin is causing this? Also check your Permalink Settings under Settings > Permalinks
Until you locate the source of your problem, you could try to get rid of it by using Redirect plugin.
This plugin has many features, two features important to your case are:
All URLs can be redirected, not just ones that don't exist
Full regular expression support
So with the help of regular expression, you would probably be able to redirect URL with numbers to a correct URL.
I had the same issue and found the solution to this issue.
Just add this to functions.php
add_action( 'template_redirect', 'so16179138_template_redirect', 0 );
function so16179138_template_redirect()
{
if( is_singular() )
{
global $post, $page;
$num_pages = substr_count( $post->post_content, '<!--nextpage-->' ) + 1;
if( $page > $num_pages ){
include( get_template_directory() . '/404.php' );
exit;
}
}
}

Custom Plugin for wordpress with hierarchy of SEF pages

Here's my issue. My company needs a vendor database added to our wordpress website. None of the existing plugins will even come close to what we need, and we already have a mysql database with all of our information, so we need to create a plugin or something to do what we need.
These urls need to be direct-accessible and have SEF urls. So, for example:
mysite.com/vendors/
mysite.com/vendors/pipe-manufacturers/
mysite.com/vendor/bobs-pipes/
And, the custom content needs to appear inside the wordpress template.
There are really 2 options:
1) Find a way to write our application outside of wordpress, but find a way to bootstrap wordpress to show the header, footer, and sidebar.
2) Run the app from inside wordpress.
So I went for option #2. I created a new template file named "vendor.php", and began working. I added this code to my functions.php of my theme:
add_filter( 'template_include', 'xyz_template_check' );
function xyz_template_check() {
global $template;
$rqst = $_SERVER['REQUEST_URI'];
$ra = split("/", $rqst);
if ($ra[1] == "vendors") {
$template_file = get_stylesheet_directory() . '/vendors.php';
return $template_file;
}
return $template;
}
So what the above code does, if it sees the word "vendors" as the first part of the url after the site name, it sends you to vendor.php. This works PERFECTLY....
except...
Wordpress believes that the page is not found. It returns a 404 header, and NOT FOUND into the page title and breadcrumb.
Adding a PAGE called "Vendor Database" with the permalink "/vendors/" fixes the main page. But there will be literally hundreds of vendors and different categories. I cant be creating a custom page for each one. This needs to be dynamic.
So, how do I make wordpress give a 200, and supply an acceptable page title, breadcrumb, etc.
Don't even get me started on the danged wp_title filter. This did NOT work as documented. Although, it just occurred to me that this might be an issue with Wordpress SEO (the wp_title filter issue).
Anyone got an idea on this?
Ok got this. The solution was to use the rewrite api, as mentioned above, to look for the pattern /vendors/, letting it know that it was a valid URL. Coupled with my existing template override, this is what I needed.

Resources