WordPress Upgrade Download failed.: SSL certificate problem

When upgrading wordpress to newer release, sometimes it may come out following error:

Download failed.: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Installation Failed

Some fixes on web forum suggest to edit curl config in php.ini file. It can be fixed quickly without touching this system level configuration. It can be fixed by editing your CURRENT theme file.

Add following codes to theme functions.php file:

add_action('http_request_args', 'jkudish_http_request_args', 10, 2);
function jkudish_http_request_args($args, $url) {
$args['sslverify'] = false;
return $args;
}

Now try to upgrade your wordpress again and it will work!

Share

Posted in Wordpress0 Comments

wordpress Missing required field entry-title updated hCard author

Under google webmaster tools structured data, you may found the following error on your wordpress web pages:

Error: Missing required field "entry-title".
Error: Missing required field "updated".
Error: Missing required hCard "author".

We need to apply following fix in single.php from theme directory

Fix – Missing required field "entry-title"

Change

<h1 class="title"><?php the_title(); ?></h1>

to

<h1 class="title entry-title"><?php the_title(); ?></h1>

Fix – Missing required field "updated".

Change

<span class="date"><?php the_time(‘Y-m-d’); ?></span>

to

<span class="date updated"><?php the_time(‘Y-m-d’); ?></span>

Fix – Missing required hCard "author"

Change

<?php the_author(); ?>

to

<span class="vcard author"><span class="fn"><?php the_author(); ?></span></span>

If you prefer not to show up such parameters public, you can hide it from background. Just add the following to functions.php, it’s a solution from wordpress forum.

function add_hatom_data($content) {
    $t = get_the_modified_time(‘F jS, Y’);
    $author = get_the_author();
    $title = get_the_title();
if (is_singular()) {
        $content .= ‘<div class="hatom-extra" style="display:none;visibility:hidden;"><span class="entry-title">’.$title.’</span> was last modified: <span class="updated"> ‘.$t.’</span> by <span class="author vcard"><span class="fn">’.$author.’</span></span></div>’;
    }
    return $content;
    }
add_filter(‘the_content’, ‘add_hatom_data’);

Share

Posted in Wordpress0 Comments

Add WordPress Canonical Tag Automatically

Cononical tag is important for search engine friendly. It tells search engine only the specified url is in use. Following are codes to generate "rel=cononical" tag automatically in page header.

First, add the following to functions.php file under your wordpress theme directory

function whp_archive_link( $paged = true ) {
        $link = false;
 
        if ( is_front_page() ) {
                $link = home_url( ‘/’ );
        } else if ( is_home() && "page" == get_option(‘show_on_front’) ) {
                $link = get_permalink( get_option( ‘page_for_posts’ ) );
        } else if ( is_tax() || is_tag() || is_category() ) {
                $term = get_queried_object();
                $link = get_term_link( $term, $term->taxonomy );
        } else if ( is_post_type_archive() ) {
                $link = get_post_type_archive_link( get_post_type() );
        } else if ( is_author() ) {
                $link = get_author_posts_url( get_query_var(‘author’), get_query_var(‘author_name’) );
        } else if ( is_archive() ) {
                if ( is_date() ) {
                        if ( is_day() ) {
                                $link = get_day_link( get_query_var(‘year’), get_query_var(‘monthnum’), get_query_var(‘day’) );
                        } else if ( is_month() ) {
                                $link = get_month_link( get_query_var(‘year’), get_query_var(‘monthnum’) );
                        } else if ( is_year() ) {
                                $link = get_year_link( get_query_var(‘year’) );
                        }                                              
                }
        }
 
        if ( $paged && $link && get_query_var(‘paged’) > 1 ) {
                global $wp_rewrite;
                if ( !$wp_rewrite->using_permalinks() ) {
                        $link = add_query_arg( ‘paged’, get_query_var(‘paged’), $link );
                } else {
                        $link = user_trailingslashit( trailingslashit( $link ) . trailingslashit( $wp_rewrite->pagination_base ) . get_query_var(‘paged’), ‘archive’ );
                }
        }
        return $link;
}

Then add the following to header.php file

<?php
if(is_home()) { ?>
<link rel="canonical" href="<?php echo whp_archive_link();?>"/>
<?php } ?>
<?php
if(is_category()) { ?>
<link rel="canonical" href="<?php echo whp_archive_link();?>"/>
<?php } ?>
<?php
if(is_single())  { ?>
<link rel="canonical" href="<?php the_permalink(); ?>"/>
<?php }?>
<?php
if(is_tag()) { ?>
<link rel="canonical" href="<?php echo whp_archive_link();?>"/>
<?php }?>

Now, all your pages have added its own cononical tag.

 

Share

Posted in Wordpress0 Comments