ワードプレスでnext_posts_link();
はhttp://currenturl.com/currentpage**/page/x/**
. functions.php に何を追加してhttp://baseurl.com/page/x/
、すべての場合に返すことができるので、現在のページに /page/x/ を追加するだけで絶対 URL を返すことができます。
あなたのアイデアをありがとう!
$url = 'http://' . $_SERVER['SERVER_NAME'] . next_posts_link();
正規表現はあなたの友達です:
$test = 'http://example.com/test';
$test = preg_replace('/^http:\/\/.*?(\/.*)/', "http://baseurl.com$1", $test);
echo $test;
ニーズに合わせて調整します。ベース URL を定数として定義し、この機能を関数にカプセル化することは価値があるかもしれません。