{"id":1319,"date":"2011-11-13T00:12:07","date_gmt":"2011-11-12T15:12:07","guid":{"rendered":"http:\/\/codaholic.org\/?p=1319"},"modified":"2020-08-23T17:37:49","modified_gmt":"2020-08-23T08:37:49","slug":"wordpressfunctions-php%e3%81%ae%e9%96%a2%e6%95%b0%e5%ae%9a%e7%be%a9%e3%83%96%e3%83%ad%e3%83%83%e3%82%af%e3%81%ae%e4%b8%ad%e3%81%a7wpdb%e3%82%92%e4%bd%bf%e3%81%86","status":"publish","type":"post","link":"https:\/\/codaholic.org\/?p=1319","title":{"rendered":"[WordPress] functions.php \u306e\u95a2\u6570\u5b9a\u7fa9\u30d6\u30ed\u30c3\u30af\u306e\u4e2d\u3067 $wpdb \u3092\u4f7f\u3046"},"content":{"rendered":"<p>WordPress \u3067\u4f7f\u3063\u3066\u3044\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3068\u304d\u306b $wpdb \u30af\u30e9\u30b9\u3092\u4f7f\u3046\u3068\u4fbf\u5229\u3067\u3059\u3002\u305d\u306e $wpdb \u306f functions.php \u306e\u4e2d\u3067\u3082\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u95a2\u6570\u5b9a\u7fa9\u30d6\u30ed\u30c3\u30af\u306e\u4e2d\u3067\u4f7f\u7528\u3059\u308b\u306b\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b global \u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p><strong>functions.php<\/strong><\/p>\n<pre><code class=\"language-php\">function get_hoge(){\n    global $wpdb; \/\/ global\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u3046\u3053\u3068\u3067$wpdb\u30af\u30e9\u30b9\u3092\u5229\u7528\u3067\u304d\u308b\n    $response = $wpdb-&gt;get_var(\"SQL\");\n    return $response;\n}\n<\/code><\/pre>\n<p>$wpdb \u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308c\u3070\u72ec\u81ea\u306e SQL \u3092\u4f5c\u3063\u3066\u3001WordPress \u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u3042\u3089\u3086\u308b\u60c5\u5831\u3092\u53d6\u308a\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u3066\u4fbf\u5229\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress \u3067\u4f7f\u3063\u3066\u3044\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3068\u304d\u306b $wpdb \u30af\u30e9\u30b9\u3092\u4f7f\u3046\u3068\u4fbf\u5229\u3067\u3059\u3002\u305d\u306e $wpdb \u306f functions.php \u306e\u4e2d\u3067\u3082\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u95a2\u6570\u5b9a\u7fa9\u30d6\u30ed\u30c3\u30af\u306e\u4e2d\u3067\u4f7f\u7528\u3059\u308b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[1],"tags":[185,242,184],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8gd1W-lh","_links":{"self":[{"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/posts\/1319"}],"collection":[{"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codaholic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1319"}],"version-history":[{"count":5,"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/posts\/1319\/revisions"}],"predecessor-version":[{"id":2447,"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/posts\/1319\/revisions\/2447"}],"wp:attachment":[{"href":"https:\/\/codaholic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codaholic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codaholic.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}