升級到 Wordpress 5.4 后,我們發(fā)現(xiàn)它<p>在 Javascript 代碼中插入了流氓標(biāo)簽,而這些代碼以前用于我們的 Buddypress 活動提要。代碼包含在對 bp_get_template_part 的調(diào)用中:bp_get_template_part( 'activity/submit-tabs' );下面是來自 Web 檢查器的代碼示例,顯示了這些 roque<p>標(biāo)記:<p><script> jQuery(function($) { var input = $('#our-activity-action-input'); var privacy = $('#our-activity-action-privacy'); var type = $('#our-activity-action-type'); var button = $('#our-activity-action-button');</p><p> type.change(function() { var typeValue = type.val(); var placeholder = '';</p><p> if (typeValue == 'news') { placeholder = 'Enter the URL of a news article you’d like to rate or fact-check.'; }</p><p> input.attr('placeholder', placeholder); });</p><p> button.click(function() { var inputValue = input.val().trim();</p><p> if (!inputValue) { input.val('').focus(); return false; }</p><p> var submitAction = function() { var typeValue = type.val();</p><p> var action; var actionInput; var actionSubmit;</p><p> if (typeValue == 'news') { action = $('.our-activity-actions .action-news'); actionInput = action.find('#af_ournews_url_input'); actionSubmit = action.find('#af_ournews_url_submit'); } else if (typeValue == 'claim') { action = $('.our-activity-actions .action-claim'); actionInput = action.find('#af_ournews_url_input_quote'); actionSubmit = action.find('#af_ournews_url_submit_quote'); } else if (typeValue == 'status') { action = $('.our-activity-actions .action-status'); actionInput = action.find('#whats-new'); actionSubmit = action.find('#aw-whats-new-submit'); }
1 回答

千巷貓影
TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超7個贊
好吧,我們找到了一個可行的 hacky 解決方法,但必須有更好的方法:
add_filter ('the_content','our_remove_autop',0);
function our_remove_autop($content)
{
$request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
$is_activity = strpos($request_uri, 'activity/',0);
if ($is_activity)
{
remove_filter('the_content','wpautop');
}
return $content;
}
- 1 回答
- 0 關(guān)注
- 81 瀏覽
添加回答
舉報
0/150
提交
取消