{"id":2775,"date":"2025-06-11T06:45:01","date_gmt":"2025-06-10T22:45:01","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/wpcms\/wpdt\/2775.html"},"modified":"2025-06-11T06:45:01","modified_gmt":"2025-06-10T22:45:01","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8-wordpress-%e4%b8%ad%e6%98%be%e7%a4%ba%e6%82%a8%e6%96%87%e7%ab%a0%e7%9a%84%e6%9c%80%e5%90%8e%e6%9b%b4%e6%96%b0%e6%97%a5%e6%9c%9f","status":"publish","type":"post","link":"https:\/\/www.zhaozhao123.cn\/wpcms\/post\/2775.html","title":{"rendered":"\u5982\u4f55\u5728 WordPress \u4e2d\u663e\u793a\u60a8\u6587\u7ae0\u7684\u6700\u540e\u66f4\u65b0\u65e5\u671f"},"content":{"rendered":"<div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--1\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/dyA-1-400x300.jpg\" alt=\"Bug&#32534;&#35793;&#29422;\" class=\"wp-image-1842\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<p class=\"my-0\">Bug&#32534;&#35793;&#29422;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#35201;&#22312;WordPress&#20013;&#26174;&#31034;&#25991;&#31456;&#30340;&#26368;&#21518;&#26356;&#26032;&#26085;&#26399;&#65292;&#20320;&#21487;&#20197;&#36890;&#36807;&#20197;&#19979;&#27493;&#39588;&#23454;&#29616;&#65306;<\/p>\n<h3>&#27493;&#39588;1&#65306;&#33719;&#21462;&#25991;&#31456;&#26368;&#21518;&#19968;&#27425;&#20462;&#25913;&#30340;&#26102;&#38388;<\/h3>\n<p>&#39318;&#20808;&#65292;&#20320;&#38656;&#35201;&#20174;&#25968;&#25454;&#24211;&#20013;&#33719;&#21462;&#25991;&#31456;&#30340;&#26368;&#21518;&#19968;&#27425;&#20462;&#25913;&#26102;&#38388;&#12290;WordPress&#20351;&#29992;<code>wp_postmeta<\/code>&#34920;&#26469;&#23384;&#20648;&#25991;&#31456;&#20803;&#25968;&#25454;&#65292;&#21253;&#25324;&#21457;&#24067;&#21644;&#20462;&#25913;&#26102;&#38388;&#12290;<\/p>\n<pre><code class=\"language-sql\">SELECT post_modified_gmt FROM wp_posts WHERE ID = &#20320;&#30340;&#25991;&#31456;ID;<\/code><\/pre>\n<p>&#20363;&#22914;&#65292;&#22914;&#26524;&#20320;&#24819;&#33719;&#21462;&#25991;&#31456;ID&#20026;20&#30340;&#25991;&#31456;&#30340;&#26368;&#21518;&#20462;&#25913;&#26102;&#38388;&#65292;&#21487;&#20197;&#36825;&#26679;&#26597;&#35810;&#65306;<\/p>\n<pre><code class=\"language-sql\">SELECT post_modified_gmt FROM wp_posts WHERE ID = 20;<\/code><\/pre>\n<h3>&#27493;&#39588;2&#65306;&#26684;&#24335;&#21270;&#26102;&#38388;&#20197;&#26174;&#31034;&#26368;&#21518;&#26356;&#26032;&#26085;&#26399;<\/h3>\n<p>&#19968;&#26086;&#20320;&#26377;&#20102;&#25991;&#31456;&#30340;&#26368;&#21518;&#19968;&#27425;&#20462;&#25913;&#26102;&#38388;&#65292;&#20320;&#21487;&#20197;&#23558;&#20854;&#36716;&#25442;&#20026;&#26131;&#20110;&#38405;&#35835;&#30340;&#26684;&#24335;&#12290;WordPress&#40664;&#35748;&#20351;&#29992;&#30340;&#26159;GMT&#26102;&#38388;&#25139;&#65292;&#25105;&#20204;&#36890;&#24120;&#38656;&#35201;&#23558;&#20854;&#36716;&#25442;&#20026;&#26356;&#26131;&#35835;&#30340;&#24418;&#24335;&#65292;&#27604;&#22914;&#26085;&#26399;&#21644;&#26102;&#38388;&#12290;<\/p>\n<pre><code class=\"language-php\">$last_modified = get_post_meta( $post-&gt;ID, 'post_last_modified', true );\n$timestamp = strtotime($last_modified);\n$formatted_date = date('Y-m-d H:i:s', $timestamp);\n\necho \"&#25991;&#31456;&#26368;&#21518;&#26356;&#26032;&#20110;: $formatted_date\";<\/code><\/pre>\n<h3>&#31034;&#20363;&#20195;&#30721;<\/h3>\n<p>&#20551;&#35774;&#20320;&#24050;&#32463;&#26377;&#19968;&#20010;&#21517;&#20026;<code>my_last_updated_date<\/code>&#30340;&#33258;&#23450;&#20041;&#23383;&#27573;&#65292;&#29992;&#20110;&#23384;&#20648;&#25991;&#31456;&#30340;&#26368;&#21518;&#20462;&#25913;&#26102;&#38388;&#65292;&#37027;&#20040;&#20320;&#21487;&#20197;&#36825;&#26679;&#20570;&#65306;<\/p>\n<pre><code class=\"language-php\">\/\/ &#20551;&#35774;&#25991;&#31456;ID&#20026;20\n$post_id = 20;\n\n\/\/ &#33719;&#21462;&#25991;&#31456;&#26368;&#21518;&#20462;&#25913;&#26102;&#38388;&#24182;&#26684;&#24335;&#21270;\n$last_modified = get_post_meta( $post_id, 'my_last_updated_date', true );\n$timestamp = strtotime($last_modified);\n$formatted_date = date('Y-m-d H:i:s', $timestamp);\n\n\/\/ &#36755;&#20986;&#25991;&#31456;&#26368;&#21518;&#26356;&#26032;&#26085;&#26399;\necho \"&#25991;&#31456;&#26368;&#21518;&#26356;&#26032;&#20110;: $formatted_date\";<\/code><\/pre>\n<h3>&#25928;&#26524;&#35828;&#26126;<\/h3>\n<p>&#36825;&#20010;&#20195;&#30721;&#29255;&#27573;&#20250;&#36755;&#20986;&#25991;&#31456;&#30340;&#26368;&#21518;&#26356;&#26032;&#26085;&#26399;&#65292;&#20363;&#22914;&ldquo;&#25991;&#31456;&#26368;&#21518;&#26356;&#26032;&#20110;: 2023-04-01 12:34:56&rdquo;&#12290;&#22914;&#26524;&#20320;&#30340;&#24212;&#29992;&#31243;&#24207;&#25110;&#27169;&#26495;&#20351;&#29992;&#20102;&#36825;&#20010;&#20989;&#25968;&#65292;&#23427;&#23558;&#20250;&#22312;&#39029;&#38754;&#19978;&#27491;&#30830;&#26174;&#31034;&#25991;&#31456;&#30340;&#26368;&#21518;&#20462;&#25913;&#26085;&#26399;&#12290;<\/p>\n<h3>&#27880;&#24847;&#20107;&#39033;<\/h3>\n<ul>\n<li>&#30830;&#20445;&#20320;&#26377;&#36275;&#22815;&#30340;&#26435;&#38480;&#35775;&#38382;&#21644;&#20462;&#25913;&#25991;&#31456;&#30340;&#20803;&#25968;&#25454;&#12290;<\/li>\n<li>&#22914;&#26524;&#20320;&#30340;&#25991;&#31456;&#21487;&#33021;&#26377;&#22810;&#20010;&#29256;&#26412;&#65288;&#22914;&#33609;&#31295;&#65289;&#65292;&#30830;&#20445;&#36873;&#25321;&#27491;&#30830;&#30340;&#29256;&#26412;&#12290;<\/li>\n<li>&#26681;&#25454;&#20320;&#30340;&#38656;&#27714;&#65292;&#20320;&#21487;&#33021;&#36824;&#38656;&#35201;&#28155;&#21152;&#19968;&#20123;&#38169;&#35823;&#22788;&#29702;&#36923;&#36753;&#65292;&#27604;&#22914;&#26816;&#26597;&#26159;&#21542;&#25214;&#21040;&#20102;&#25991;&#31456;&#30340;ID&#25110;&#32773;&#39564;&#35777;&#33258;&#23450;&#20041;&#23383;&#27573;&#26159;&#21542;&#23384;&#22312;&#12290;<\/li>\n<\/ul>\n<p>&#36890;&#36807;&#20197;&#19978;&#27493;&#39588;&#65292;&#20320;&#24212;&#35813;&#33021;&#22815;&#22312;WordPress&#20013;&#25104;&#21151;&#26174;&#31034;&#25991;&#31456;&#30340;&#26368;&#21518;&#26356;&#26032;&#26085;&#26399;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div><div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--2\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/zp-400x300.jpg\" alt=\"&#40657;&#26495;&#21069;&#30340;Bug&#35821;&#27861;&#35762;&#24072;\" class=\"wp-image-1849\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<p class=\"my-0\">&#40657;&#26495;&#21069;&#30340;Bug&#35821;&#27861;&#35762;&#24072;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#22312;WordPress&#20013;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#22810;&#31181;&#26041;&#24335;&#26469;&#26174;&#31034;&#25991;&#31456;&#30340;&#26368;&#21518;&#26356;&#26032;&#26085;&#26399;&#12290;&#20197;&#19979;&#26159;&#19968;&#20123;&#24120;&#35265;&#30340;&#26041;&#27861;&#65306;<\/p>\n<h3>&#26041;&#27861;1&#65306;&#20351;&#29992;<code>date_format<\/code>&#25554;&#20214;<\/h3>\n<p>&#39318;&#20808;&#65292;&#20320;&#38656;&#35201;&#23433;&#35013;&#24182;&#21551;&#29992;<code>date_format<\/code>&#25554;&#20214;&#12290;&#36825;&#23558;&#20801;&#35768;&#20320;&#22312;&#26631;&#39064;&#25110;&#25688;&#35201;&#20013;&#26174;&#31034;&#25991;&#31456;&#30340;&#26368;&#21518;&#26356;&#26032;&#26085;&#26399;&#12290;<\/p>\n<h4>&#23433;&#35013;&#25554;&#20214;<\/h4>\n<ul>\n<li>&#25171;&#24320;WordPress&#21518;&#21488;&#12290;<\/li>\n<li>&#28857;&#20987;&ldquo;&#25554;&#20214;&rdquo; &gt; &ldquo;&#31649;&#29702;&#25554;&#20214;&rdquo;&#12290;<\/li>\n<li>&#25628;&#32034;&#24182;&#21551;&#29992;&ldquo;date_format&rdquo;&#12290;<\/li>\n<\/ul>\n<h4>&#31034;&#20363;&#20195;&#30721;<\/h4>\n<pre><code class=\"language-php\">add_filter( 'pre_get_posts', 'my_pre_get_posts' );\nfunction my_pre_get_posts( $query ) {\n    if ( ! is_admin() &amp;&amp; $query-&gt;is_main_query() &amp;&amp; 'post' === $query-&gt;get('post_type') ) {\n        $query-&gt;set( 'orderby', 'modified' ); \/\/ &#20462;&#25913;&#25490;&#24207;&#26041;&#24335;&#20026;&#26368;&#26032;\n        $query-&gt;set( 'order', 'DESC' ); \/\/ &#35774;&#32622;&#38477;&#24207;&#25490;&#21015;\n    }\n}<\/code><\/pre>\n<h3>&#26041;&#27861;2&#65306;&#20351;&#29992;<code>wp_head<\/code>&#26631;&#31614;<\/h3>\n<p>&#22914;&#26524;&#20320;&#19981;&#24819;&#20351;&#29992;&#39069;&#22806;&#30340;&#25554;&#20214;&#65292;&#21487;&#20197;&#22312;WordPress&#30340;&#20027;&#39064;&#25991;&#20214;&#20013;&#28155;&#21152;&#19968;&#20010;&#33258;&#23450;&#20041;&#30340;CSS&#31867;&#21040;<code>.post-date<\/code>&#26631;&#31614;&#19978;&#65292;&#28982;&#21518;&#22312;<code>wp_head<\/code>&#26631;&#31614;&#20869;&#28155;&#21152;&#36825;&#20010;&#31867;&#12290;<\/p>\n<h4>&#31034;&#20363;&#20195;&#30721;<\/h4>\n<pre><code class=\"language-html\">&lt;style&gt;\n.post-date { \/* &#28155;&#21152;CSS&#26679;&#24335; *\/\n  color: #0078c7;\n}\n&lt;\/style&gt;\n\n&lt;div class=\"post-date\"&gt;\n  &lt;time datetime=\"2023-04-05\"&gt;2023&#24180;4&#26376;5&#26085;&lt;\/time&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<h3>&#26041;&#27861;3&#65306;&#20351;&#29992;<code>single.php<\/code>&#27169;&#26495;&#20013;&#30340;<code>date<\/code>&#20989;&#25968;<\/h3>\n<p>&#22914;&#26524;&#20320;&#24819;&#22312;&#19968;&#20010;&#29305;&#23450;&#30340;&#25991;&#31456;&#39029;&#38754;&#20013;&#26174;&#31034;&#25991;&#31456;&#30340;&#26368;&#21518;&#26356;&#26032;&#26085;&#26399;&#65292;&#21487;&#20197;&#20351;&#29992;<code>single.php<\/code>&#27169;&#26495;&#20013;&#30340;<code>date<\/code>&#20989;&#25968;&#12290;&#20363;&#22914;&#65292;&#22914;&#26524;&#35201;&#26174;&#31034;2023&#24180;4&#26376;5&#26085;&#30340;&#26085;&#26399;&#65292;&#20320;&#21487;&#20197;&#36825;&#26679;&#20570;&#65306;<\/p>\n<pre><code class=\"language-php\">&lt;?php the_time('F j, Y'); ?&gt;<\/code><\/pre>\n<h3>&#26041;&#27861;4&#65306;&#20351;&#29992;<code>postmeta<\/code>&#21644;<code>meta-boxes<\/code>&#21151;&#33021;<\/h3>\n<p>&#38500;&#20102;&#19978;&#36848;&#26041;&#27861;&#22806;&#65292;&#36824;&#21487;&#20197;&#36890;&#36807;&#35774;&#32622;<code>postmeta<\/code>&#21644;<code>meta-boxes<\/code>&#21151;&#33021;&#26469;&#23454;&#29616;&#27492;&#30446;&#30340;&#12290;&#36825;&#31181;&#26041;&#27861;&#38656;&#35201;&#19968;&#20123;&#26381;&#21153;&#22120;&#31471;&#32534;&#31243;&#30693;&#35782;&#65292;&#29305;&#21035;&#26159;PHP&#12290;<\/p>\n<h4>&#31034;&#20363;&#20195;&#30721;<\/h4>\n<pre><code class=\"language-php\">\/\/ &#22312;&#20027;&#39064;&#30446;&#24405;&#19979;&#21019;&#24314;&#19968;&#20010;&#21517;&#20026;'my-custom-meta-box'&#30340;&#25991;&#20214;&#22841;&#12290;\n\/\/ &#21516;&#26102;&#65292;&#22312;&#35813;&#25991;&#20214;&#22841;&#20013;&#21019;&#24314;&#19968;&#20010;&#21517;&#20026;'my-custom-meta-box.php'&#30340;&#25991;&#20214;&#12290;\n\/\/ &#36825;&#20010;&#25991;&#20214;&#24212;&#35813;&#21253;&#21547;&#20197;&#19979;&#20869;&#23481;&#65306;\n\/\/ function create_post_meta_box($post) {\n\/\/     echo '&lt;label for=\"last_modified_date\"&gt;' . __('Last Modified Date', 'your-plugin-name') . '&lt;\/label&gt;';\n\/\/     echo '&lt;input type=\"text\" id=\"last_modified_date\" name=\"last_modified_date\"&gt;';\n\/\/     echo '&lt;br&gt;&lt;button type=\"submit\" id=\"save_last_modified_date\"&gt;Save Changes&lt;\/button&gt;';\n\/\/     echo '&lt;\/form&gt;';\n\/\/ }\n\nadd_action('admin_menu', 'create_post_meta_box');\nadd_action('edit_form_after_title', 'create_post_meta_box');\n\nfunction save_custom_post_meta( $post_id ) {\n    update_post_meta( $post_id, 'custom_last_modified_date', $_POST['last_modified_date'] );\n}\n\nadd_action('save_post', 'save_custom_post_meta');<\/code><\/pre>\n<p>&#35831;&#27880;&#24847;&#65292;&#36825;&#20123;&#26041;&#27861;&#21487;&#33021;&#38656;&#35201;&#26681;&#25454;&#20320;&#30340;WordPress&#29256;&#26412;&#20197;&#21450;&#20320;&#25152;&#29992;&#30340;&#20027;&#39064;&#24211;&#26469;&#35843;&#25972;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Bug&#32534;&#35793;&#29422; &#35201;&#22312;WordPress&#20013;&#26174;&#31034;&#25991;&#31456;&#30340;&#26368;&#21518;&#26356;&#26032;&#26085;&#26399;&#65292;&#038;#2..<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[59],"tuisongtax":[],"class_list":["post-2775","post","type-post","status-publish","format-standard","hentry","category-wpdt","tag-pzjc"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/2775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/comments?post=2775"}],"version-history":[{"count":0,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/2775\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/media?parent=2775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/categories?post=2775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tags?post=2775"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tuisongtax?post=2775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}