我有18,000多個wordpress帖子,我使用的是一個函數來隱藏帖子中的第一張圖片,但我不想再這麼做。我只想使用精選圖片,就是這樣,而不必在帖子中插入精選圖片來隱藏它(使用該功能)。手動刪除wordpress數據庫中的第一張圖片
我在考慮只是手動刪除文本編輯器中的所有內容,但不知道要刪除哪一個,因爲它存在2或3次。例如:
INSERT INTO `wp_posts` VALUES(16179, 88, '2009-05-28 08:32:47', '2009-05-28 12:32:47', '<img src="http://localhost/readjunk/wp-content/uploads/2009/05/news_0509_takingbacksundayalbum.jpg" alt="news_0509_takingbacksundayalbum" title="news_0509_takingbacksundayalbum" width="450" height="250" class="alignnone size-full wp-image-16180" />\r\nTaking Back Sunday will be streaming New Again in its entirety on their <a href="http://www.myspace.com/takingbacksunday">MySpace page</a> on Thursday May 28th and Friday May 29th. New Again officially hits stores next Tuesday, June 2nd.\r\n<!--more-->\r\n\r\nTaking Back Sunday will <a href="http://localhost/readjunk/news/music/blink-182-reunite-and-announce-summer-tour/">be touring on select dates</a> with Blink 182. Check out their music video for Sink Into Me <a href="http://localhost/readjunk/media/music-video-taking-back-sunday-sink-into-me/">here</a>.\r\n\r\nFor more info visit: <a href="http://www.takingbacksunday.com">www.takingbacksunday.com</a>\r\n', 'MySpace hosting Taking Back Sunday "New Again" listening party tonight and Friday', 0, '', 'publish', 'open', 'open', '', 'myspace-hosting-taking-back-sunday-new-again-listening-party-tonight-and-friday', '', '', '2009-05-28 08:32:47', '2009-05-28 12:32:47', '', 0, 'http://localhost/readjunk/?p=16179', 0, 'post', '', 0, NULL);
INSERT INTO `wp_posts` VALUES(16180, 88, '2009-05-28 08:28:27', '2009-05-28 12:28:27', '', 'news_0509_takingbacksundayalbum', 0, '', 'inherit', 'open', 'open', '', 'news_0509_takingbacksundayalbum', '', '', '2009-05-28 08:28:27', '2009-05-28 12:28:27', '', 16179, 'http://localhost/readjunk/wp-content/uploads/2009/05/news_0509_takingbacksundayalbum.jpg', 0, 'attachment', 'image/jpeg', 0, NULL);
INSERT INTO `wp_posts` VALUES(16181, 88, '2009-05-28 08:32:36', '2009-05-28 12:32:36', '<img src="http://localhost/readjunk/wp-content/uploads/2009/05/news_0509_takingbacksundayalbum.jpg" alt="news_0509_takingbacksundayalbum" title="news_0509_takingbacksundayalbum" width="450" height="250" class="alignnone size-full wp-image-16180" />\nTaking Back Sunday will be streaming New Again in its entirety on their <a href="http://www.myspace.com/takingbacksunday">MySpace page</a> on Thursday May 28th and Friday May 29th. New Again officially hits stores next Tuesday, June 2nd.\n<!--more-->\n\nTaking Back Sunday will <a href="http://localhost/readjunk/news/music/blink-182-reunite-and-announce-summer-tour/">be touring on select dates</a> with Blink 182. Check out their music video for Sink Into Me <a href="http://localhost/readjunk/media/music-video-taking-back-sunday-sink-into-me/">here</a>.\n\nFor more info visit: <a href="http://www.takingbacksunday.com">www.takingbacksunday.com</a>\n', 'MySpace hosting Taking Back Sunday "New Again" listening party tonight and Friday', 0, '', 'inherit', 'open', 'open', '', '16179-revision', '', '', '2009-05-28 08:32:36', '2009-05-28 12:32:36', '', 16179, 'http://localhost/readjunk/uncategorized/16179-revision/', 0, 'revision', '', 0, NULL);
它只是img標籤或只是第一行?
很好的IDS樣子16179以上。你問如何手動做一個基於ID的刪除?有沒有其他的表格會這樣做會禁止它或把它們擰緊? – Drew
耶不知道。我在wp_posts,所以不知道爲什麼有2或3在那裏相同的職位。我正在使用一個精選的圖像插件,使用後第一個圖像,所以也許這就是創建一個額外的ID?不是程序員那麼不確定。我想刪除一個帖子中的圖像,所以不知道我是否應該嘗試刪除第二個,因爲第一個可能是附件? –
第一個是帖子,第二個是附件,第三個是修改版。你可以在插入參數中看到'post_type',它是最後一個參數「post」,「attachment」,「revision」的第4個參數。您不需要觸摸附件或修訂版,可能會刪除所有修訂版。 – totels