On my single blog pages at the very beginning, I have the html
<h6 class="entry-category is-xsmall">
<a href="www.website" rel="category tag">category title</a></h6>
I want to remove the h6 tag from all blog pages. In this forum, I found a solution for removing the h3 at the comments:
function my_comment_form_before() {
ob_start();
}
add_action( 'comment_form_before', 'my_comment_form_before' );
function my_comment_form_after() {
$html = ob_get_clean();
$html = preg_replace(
'/<h3 id="reply-title"(.*)>(.*)<\/h3>/',
'<p id="reply-title"\1>\2</p>',
$html
);
echo $html;
}
add_action( 'comment_form_after', 'my_comment_form_after' );
I tried to change it to the h6 problem:
function my_comment_form_before() {
ob_start();
}
add_action( 'comment_form_before', 'my_comment_form_before' );
function my_comment_form_after() {
$html = ob_get_clean();
$html = preg_replace(
'/<h6 class="entry-category is-xsmall"(.*)>(.*)<\/h6>/',
'<p id="reply-title"\1>\2</p>',
$html
);
echo $html;
}
add_action( 'comment_form_after', 'my_comment_form_after' );
But it is not removing the h6. How can I remove it the right way?
On my single blog pages at the very beginning, I have the html
<h6 class="entry-category is-xsmall">
<a href="www.website" rel="category tag">category title</a></h6>
I want to remove the h6 tag from all blog pages. In this forum, I found a solution for removing the h3 at the comments:
function my_comment_form_before() {
ob_start();
}
add_action( 'comment_form_before', 'my_comment_form_before' );
function my_comment_form_after() {
$html = ob_get_clean();
$html = preg_replace(
'/<h3 id="reply-title"(.*)>(.*)<\/h3>/',
'<p id="reply-title"\1>\2</p>',
$html
);
echo $html;
}
add_action( 'comment_form_after', 'my_comment_form_after' );
I tried to change it to the h6 problem:
function my_comment_form_before() {
ob_start();
}
add_action( 'comment_form_before', 'my_comment_form_before' );
function my_comment_form_after() {
$html = ob_get_clean();
$html = preg_replace(
'/<h6 class="entry-category is-xsmall"(.*)>(.*)<\/h6>/',
'<p id="reply-title"\1>\2</p>',
$html
);
echo $html;
}
add_action( 'comment_form_after', 'my_comment_form_after' );
But it is not removing the h6. How can I remove it the right way?
Share Improve this question asked Oct 6, 2020 at 7:31 flxflx 1 1 |1 Answer
Reset to default 1You don't need functions for this, just look in your theme's template files: For single posts check single.php
and for blog archive/categories check archive.php
.
Change the <h6>
in those php files to <div>
or whatever you want. It would be wiser to override them with a child theme so you don't lose your changes in a future update of the theme.
<h6 class="entry-category is-xsmall">
in any of the core WordPress files, so I'd guess it's your theme? You probably want to make a child theme and override whichever template that is. – Rup Commented Oct 6, 2020 at 23:53