Take back controlof your time Millions of people simplify their lives by installing RescueTime's automated time tracking software.
![RescueTime](https://cdn-ak-scissors.b.st-hatena.com/image/square/740a6f3872fd80c0709aa43f77ed5a2d23eb5944/height=288;version=1;width=512/https%3A%2F%2Fassets.rescuetime.com%2Fassets%2FRescueTime_Metabanner-c4dac381ee7cfd0a161300768a05eb3a676ae381e4e62ab2851d048364755bb3.png)
Take back controlof your time Millions of people simplify their lives by installing RescueTime's automated time tracking software.
名前 (必須) メールアドレス (非公開) (必須) URI Remember personal info はい いいえ コメントスタイル指定用の一部の HTMLタグが使用できます。 Add Your Comment トラックバック:0 このエントリーのトラックバックURL http://digitalbox.jp/happy-go-lucky-computing/wordpress/getting-category-id-from-slug/trackback/ Listed below are links to weblogs that reference スラッグからカテゴリIDを取得する from digitalbox Contents Let's Use Cygwin and Meadow Cygwin Meadow Happy-Go-Lucky Computing Thin
WordPressを使ってプログラミングしていると、ページスラッグからIDを取得したい場合があります。 簡単な方法としては、get_page_by_path という関数が用意されているので、これを使えばよいでしょう。 引数としてスラッグを与えて実行すると、ページのオブジェクトを返してくれるというものです。 ただ、そんなに大げさなものじゃなくて、ただIDだけ取得できればいいんだけど・・・ という場合に、私はこんな関数を作って使っています。 function get_id_by_slug($slug){ global $wpdb; $myMeta = $wpdb->get_row(" SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' and post_type = 'page' and post_name = '$slug
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く