【发布时间】:2023-10-28 20:16:01
【问题描述】:
我有以下代码可以工作并更改“收到订单”页面的标题:
add_filter( 'the_title', 'woo_title_order_received', 10, 2 );
function woo_title_order_received( $title, $id ) {
if ( function_exists( 'is_order_received_page' ) &&
is_order_received_page() && get_the_ID() === $id ) {
$title = "Thank you, good luck!";
}
return $title;
}
但是由于Too few arguments to function woo_title_order_received(),它会在商店页面上导致致命错误。上网查了一下,发现the_title不对,应该是get_the_title。如果我将其更改为致命错误消失,但它不再更改已接收订单页面上的标题。
我在网上找到的其他 sn-ps 都没有工作,我不明白为什么上面会阻止商店页面工作。有什么想法吗?
【问题讨论】:
标签: php wordpress woocommerce endpoint page-title