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

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.

Related

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

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

Prevent WordPress home page redirect after WP 4.4.1

The WP is redirecting the home page to the home_url (or site_url not sure since both are the same values) even when arrived to the page using the parked domains. This started after the recent update. Also, I confirmed, no htaccess, server configs nor any plugins doing the redirect.
After thorough research the solution I found are placing the following in the functions.php remove_action('template_redirect', 'redirect_canonical');. That solution is years old and don't seem to work anymore.
The way I set it up is I park the domains to the WP site, and the contents displayed are based on the domain. Just happens on the index page, if it has any urls appended, it works. Any help is appreciated.
It looks like the new version of the WP enforced the redirect on homepage. My issue was resolved with the remove_filter('template_redirect','redirect_canonical');. I wasn't able to see the change in effect after I applied that fix because the browser cached it somehow. I tested it on the Private mode, and it worked. I had to clear the cache to see it working.
I ran into the same issue and got i fixed, thanks to your answer. However, what are the implications of removing that filter? It sound important by name, so did you experience some new issues so far?
PS: i would have posted a comment to the previous answer, but my stackoverflow points are below 50...
LTDInvestments is actually correct. In your wp-config.php, ensure that 'WP_HOME' and 'WP_SITEURL' have values which are lowercased.
This fixed it for me; I guess case-sensitivity is something you should mind throughout your wp-config.php and wp-admin settings.
This works for me (as for version 5.9.3):
add_filter( 'redirect_canonical', 'disable_redirect_canonical', 10, 2 );
function disable_redirect_canonical( $redirect_url ) {
return false;
}
Note: this removes redirecting for urls that partly match slug of content that exists for example domain.com/terms will no longer redirect to domain.com/terms-and-conditions but instead return a 404 page.
Also changing the WordPress Address (URL) and Site Address (URL) to all lower case works.

Wordpress - uploading images to one domain but URL should be a different domain

I'm trying to get my head around this. I know Wordpress pretty well but I'm officially confused.
I have a subdomain where users can login to wordpress at dev.mysite.com/wp-admin. When they upload images to dev.mysite.com/wp-content/images/uploads, those files are lsynced to www.mysite.com/wp-content/uploads. I changed wp-config.php so that it will work on either domain.
This works okay except that in wordpress posts, when you upload an image, it uploads the domain as well so it puts in html like and my users have to go in and change dev. to www. manually since "dev." is password protected so the images won't even show up just a password prompt if they forget to do that.
Is there a way to make it so wordpress doesn't include the full path to the image? Where is that in wordpress' guts?
Add this to your themes functions.php:
add_filter( 'wp_get_attachment_url', 'wp_update_attachment_url_domain', 10, 2 );
function wp_update_attachment_url_domain ($url, $post_id)
{
$url = str_ireplace('dev.mysite.com', 'www.mysite.com', $url);
return $url;
}
This will updated the url of the image by replacing the host name.

How can I successfully use browser-sync with wordpress locally?

I'm trying to get browser-sync to work with my multipress wordpress install, for simpler mobile / responsive development.
Currently I'm having problems in that, my normal development takes place at local.example.com, and browser-sync is proxying this (via 123.456.78.9:3202, as per browser sync).
So far browser-sync loads the site, but none of my scripts or CSS are loading (although images load fine). They jsut fail with no response in the network panel.
I'm using NGINX for hosting the site, as opposed to apache.
Does anyone have any wordpress browser-sync experience? Am I missing something with the browser-sync set up? And tips for this would be super welcome. I'd love to get this as a solid part of my work flow.
The problem is to do with how wordpress handles URLs, in that it normally uses full URLs for including content and links etc.
The proxy is trying to access these on another domain and that's why it's failing.
Update
A much simple, cleaner and maintainable strategy, that also helps with development environments is to use the Root Relative URLs plugin. Adds hooks and configs similar to below, but also updates your content and editors to apply the same structure, so it's a bit more robust
Original Answer
You can add a simple hook (source: wordpress relative urls) to filter wordpress generated urls and remove the base domain so you get relative links to styles and posts etc:
$relative_url_filters = array(
'script_loader_src', //js
'style_loader_src', //css
'post_link', // Normal post link
'post_type_link', // Custom post type link
'page_link', // Page link
'attachment_link', // Attachment link
'get_shortlink', // Shortlink
'post_type_archive_link', // Post type archive link
'get_pagenum_link', // Paginated link
'get_comments_pagenum_link', // Paginated comment link
'term_link', // Term link, including category, tag
'search_link', // Search link
'day_link', // Date archive link
'month_link',
'year_link'
);
foreach ( $relative_url_filters as $relative_url_filters ) {
add_filter( $relative_url_filters, 'wp_make_link_relative' );
}
Which should clean up most of your issues and get browser-sync working nicely.
I'm still having some issues where I have more complex inclusions for images, but more or less it's working and we're already seeing how cool it is!

Duplicated permalinks on a wordpress page

First I have www.mywebsite.com/blog/ Which is another wordpress Blog under www.mywebsite.com.
Then I created a page inside www.mywebsite.com which has a url of www.mywebsite.com/blog/.
I want to change the first www.mywebsite.com/blog into www.mywebsite.com/blog2 so It won't confuse me anymore.
After changing the permalinks in the admin panel. I can't access www.mywebsite.com/blog anymore.
Is there any way to access the page of the original www.mywebsite.com/blog2/wp-admin? and view the duplicated page www.mywebsite.com/blog/?
Please comments if my question confuses you.
Thanks.
When moving your site, give the guide to moving wordpress or, in this case better, the guide of changing the wordpress url a glance.
Suppose you changed the URIs where you cannot move the files, but still can access the login page (through a redirection or something) you can recover your installation easily.
wp-login.php can be used to (re-)set the URIs. Find this line:
require( dirname(__FILE__) . '/wp-load.php' );
and insert the following lines below:
//FIXME: do comment/remove these hack lines. (once the database is updated)
update_option('siteurl', 'http://your.domain.name/the/path' );
update_option('home', 'http://your.domain.name/the/path' );
run it (once) and you are done. Test your site to make sure that it works right. If the change involves a new address for your blog, make sure you let people know the new address, and consider adding some redirection instructions in your .htaccess file to guide visitors to the new location. Delete those lines from your wp-login.php.

Resources