SANGO用メタタグをAll in One SEO・WordPress Popular Postsから一括で移植する方法

sango-metatag-img

こんにちは、薬機法に強い薬剤師セールスコピーライターの江良公宏です。

年末年始とWordpress関連の整備を行っていた関係で今日もWordpressの備忘録です。

実は、近いうちにWordpressのテーマを(ストークをかなり移植した)ハミングバードから変えようかと思っています。

って新しいテーマは既に購入しているのですが、SANGOというマテリアルデザインのテーマです。

と、いってもいきなりこのブログに適用するのはちょっと怖かったので、現在は別ブログでSEOの検証中です。

SANGOにテーマを変える際の問題点

SANGOは非常に高機能なテーマで、今までAll in One SEOやWordpress Popular Postsといったプラグインでやっていたことをテーマの標準機能として装備している、かなりすごいやつです。

とはいえ、そのままテーマを変えてしまうと、今までのAll in One SEOのメタタグやView数は引き継いでくれません。

そこで・・・

『All in One SEOやWordpress Popular Postsのメタタグを一発で移植するプラグイン』

を自作で創りました。

あ、PHPに関してはかなり素人なので、動けば良いという方限定です(^^;)

で、例によってSyntax Highlighter入れていないので、見づらいですがご容赦を。

PhpMyAdminを使ってSANGOのメタタグの格納場所を探す

WordPressデフォルト機能である『抜粋』は『wp_posts』(wp_はDB接頭辞)内に格納されている。

一方、All in One SEOのディスクリプションが格納されているのは『wp_postmeta』の『_aioseop_description』

では、SANGOはというと、『wp_postmeta』内の『sng_meta_description』『post_views_count』に格納されている。

ちなみに、WPPのデータは『wp_popularpostsdata』の『pageviews』に格納されている。

ということで、これらをSANGO用にコピーすればOK。

別件でPhpMyAdmin使っていたので使いましたが、SANGOのソース読んで探した方が早いです。

実際に使ったコード

<?php
/*
Plugin Name: AIO-WPP to SANGOmeta
Plugin URI: https://892copy.jp/
*/
register_activation_hook( __FILE__, ‘aiowpp_activation_run’ );

function aiowpp_activation_run()
{
/* 取得する投稿の範囲を定義 */
$args = array(
‘post_type’ => array(‘post’,’page’)
, ‘numberposts’ => -1
, ‘post_status’ => published
);
/* 投稿内容をDBから取得して格納 */
$posts = get_posts( $args );
/* foreach (配列 as 変数) 一覧のうち1つを変数にセットして終わるまで連続処理 */
foreach ( $posts as $post )
{
/* metaからAIOのディスクリプションを取得 */
$aioseop = get_post_meta( $post->ID, ‘_aioseop_description’ ,true);
/* metaからWordpress popular postのカウント数を取得 */
$wpp = wpp_get_views( $post->ID );
/* SANGO用view数の書き込み */
update_post_meta( $post->ID, ‘post_views_count’, $wpp );
/* AIOのディスクリプションが空なら処理exit */
if( ” != $aioseop )
{
/* SANGO用メタディスクリプションの書き込み */
update_post_meta( $post->ID, ‘sng_meta_description’, $aioseop );
}
}
}
?>

上記もしくは下記ファイルをプラグインフォルダにアップして、一度有効化すればOK。最初に一度やれば、あとは削除してOKです。

aioseo-wpp-sango(ZIPファイル)

ただ、記事数が多い場合は時間がかかってPHPの実行エラーが起こる可能性あり。その場合は、一度無効にして再度有効化を繰り返してみるとそのうち終わる、はず。

実際のサイトで動作検証はしていますが、使用は自己責任でお願いします。(『sng_meta_description』『post_views_count』については問答無用で上書きしますので注意)

DBのバックアップ、大事!!!!!

※質問は受け付けません(というか回答するほどのスキルはない)のでご容赦を。

1 COMMENT

Danielinz

Let’s take an appearance. Instead, put in the time to learn more about her better and develop a solid connection based on depend on and common regard. Everyone has right to deal with their personal happiness. The trick to an effective online dating experience with Ukrainian ladies hinges on picking the right Ukraine dating agency. If UkraineBride4you is right for you, check out some vital facts about this popular dating website to decide. BravoDate is certainly the best global online dating website to sign up with if you want to fulfill solitary Ukrainian women. You want to have an understanding, loyal person at hand. Many local women have aspirations of starting family members and raising children together with their committed spouses. Finding life companion online has been a main means for many singles and undoubtedly, Ukrainian dating services have been valuable for numerous gentlemen that look for Ukrainian women for marriage. Your real love may be hiding behind the photos of charming women online.

With the UkraineDate mobile application, you can create a new account and start composing your love story in a matter of mins. UkraineBride4you is just one of the finest Ukrainian dating websites you can find online. This is just one of the finest European dating websites with some of the most detailed accounts with those confirmed badges. You need to obtain ready in advance if you want to get the best out of dating these wonderful women. Simple motions such as unlocking for her, drawing out her chair, or supplying your coat on a chilly evening can leave a favorable and long-term impact. Look into our extensive all-in-one plans to safeguard all your gadgets from deceitful and destructive activity regardless of what device you’re using. Bitdefender all-in-one plans provide acclaimed antimalware security and progressed anti-phishing and anti-fraud filtering system systems that warn you whenever you check out a web site that might attempt to scam you. LoveForHeart is another quality website that might help songs looking for their ideal match in Ukraine. It accepts only Ukrainian females who are trying to find a sweetheart and, ideally, a fiancé and supplies both female and male participants with the sophisticated devices to find a best partner.

AmourFactory is among the on-line dating sites with Ukrainian and Russian females (there are also female members from some other Eastern European countries) that encourages female members to give as much details as possible to enhance the dating experience for male members. Also, both male and female customers can obtain what they want quickly as the choice of attributes goes over, as well. You also get a powerful VPN with unrestricted web traffic for your Smart device, computer and tablet computer plus a helpful Password Manager to help you keep your sensitive information passwords, among lots of other functions depending upon the picked strategy. Are you looking for help prioritizing your electronic safety? With a dedication to linking Ukrainian singles both locally and worldwide, we give you a very easy and safe atmosphere developed to help you satisfy the love of your life! Girls always like special idea of recommending, they always enjoy a guy that is enchanting and clever. That’s not an excellent idea. Also, finding out a couple of expressions and possibly finding out a brand-new language is a good idea. Over the previous couple of years, Ukraine has undergone considerable changes that have affected its social dynamics, including dating and partnerships. Tip 1. Don’t concentrate on one online dating system – take into consideration numerous choices instead.

Now, allow’s see the main advantages and downsides of the dating platform. Most guys satisfy them on global dating websites, however it’s not that very easy to find a great Ukrainian dating system. By doing this, you’re most likely to discover the love of your life, as somebody will certainly appreciate you for who you are. [url=https://www.newswire.com/charmingdate-com-live-chat-now/257451]charmingdate[/url] The site works much more like Tinder – participants discover random matches and chat with the ones they such as. When it comes to the remainder, it functions mainly like other international dating systems – there are real-time messaging, Mails, extended and fundamental search, gift distribution – primarily whatever that somebody might require to locate the very best suits among female participants and call them, and begin a relationship with an unique lady online. Dating platforms such as these are infamous for making use of crawlers to promote communication with as numerous individuals as feasible. We recommend reviewing independent reviews that define just how prominent Eastern European dating websites function, what features they have, what they charge, and how completely satisfied their individuals are. Most features are cost-free – you can view accounts, like them, see shared matches, and use search. If are seeking Ukrainian singles for friendship, dating, or major relationships, you can find the ideal suit for you right here.

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です