wp_insert_postとカスタム分類
Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /home/gogoweb/55w.jp/public_html/techblog/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524
先日、カスタム分類をTaxInputで登録できるはずなのに全然うまくいかないで困っていました。
結局よくわからなかったのと、よく考えたら後からカスタム分類を別個追加したほうが楽なんじゃないかと気が付き、方法を変更しました。
$id = wp_insert_post($post_data); wp_set_object_terms($id,$tags,'hash_tag');
wp_insert_postは返り値にpost_idを返します。そこで、投稿設定をした後にそのpost_idで
wp_set_object_termsを使いカスタム分類を追加しています。これはhash_tagというカスタム分類に$tagsの内容を登録しています。
これでハッシュタグ(ついでにユーザー名も)を関連付けた投稿をポストすることに成功しました。
次の問題は一日に呟かれる設定ワードの呟きが100~200件程あるのであっという間に1万件近いデータになってしまうことです。
だいたい一ヶ月相当として5000件あたりをめどに自動で古い投稿を消すべきなのか、蓄積しても大丈夫なのか・・・
あまりデータ量が多くなってパフォーマンスが下がっては本末転倒なので、一定投稿数をこえたらバックアップをとって削除というのがスマートなのかもしれません。
Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /home/gogoweb/55w.jp/public_html/techblog/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524
Tweets that mention wp_insert_postとカスタム分類 -- Topsy.com (9年)
Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /home/gogoweb/55w.jp/public_html/techblog/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524
[…] This post was mentioned on Twitter by ゴーゴーウェブ池田, ゴーゴーウェブ池田. ゴーゴーウェブ池田 said: wp_insert_postとカスタム分類 http://is.gd/fAuFm3 […]