我已經搜索了很多,我唯一找到的是wp_redirect()。要使用該功能,我需要編輯站點中的檔案。但我只想使用一個檔案與我的 wordpress 網站進行通信。那么,有沒有其他方法可以從額外的 php 檔案中重定向帖子,如下所示:
redirect_post_to_link($post_id, $link);
我已經嘗試(想到的第一種方法)將帖子內容更新<meta http-equiv="refresh" content="0;URL=https://www.examplewpsite.com/postblabla">為
include("wp-load.php")
$post = get_post( $post_id );
$post->post_content = $redirect_code
$update_output = wp_update_post( $post );
if($update_output != 0){ // ...code continues...
但它實際上并沒有更新帖子,當您訪問帖子時,您會得到空白內容。
對不起,如果我問了一個不正確的問題。
uj5u.com熱心網友回復:
我剛剛找到了解決這個問題的方法。在更新程序中洗掉過濾kses_remove_filters()器使我可以更新我想要的任何內容。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/415340.html
標籤:
