New answers tagged

0 votes

Change the slug of post type using custom code

There is a function called wp_unique_post_slug which is called whenever you save a post. This function contains a filter of the same name that you can use to modify the slug, depending on, for ...
cjbj's user avatar
  • 14.1k
0 votes

Adding content to the top of post's based on their category

You can use the the_content filter for this: add_filter( 'the_content', 'wpse420024_filter_content' ); /** * Conditionally adds content above the post content. * * @param string $content The post ...
Pat J's user avatar
  • 11.5k
0 votes

set role specific screen options in post summary page

You would use the default_hidden_columns filter. Here's an example of what I did to hide a column in the Media Library: add_filter( 'default_hidden_columns', function( array $hidden, WP_Screen $screen ...
Gavin's user avatar
  • 339
0 votes

How can I specify a category post on my home page

Quick example we are using in HoverCraft inside index.php that fails gracefully, which will affect either your homepage and/or "Posts page" depending on your settings: <?php ...
Jesse Nickles's user avatar
0 votes

Show posts assigned to multiple categories in current category page

That's because that's what you're asking for: 'category__in' => array($category), It's only going to show posts in that category. You shouldn't be using get_posts() or WP_Query() in category.php. ...
Jacob Peattie's user avatar
1 vote

Show category name in category.php when posts assigned to multiple categories

For the heading on a category archive use either: the_archive_title(); Or: single_term_title(); The first one can be used on the template for any archive, while the second should only be used on ...
Jacob Peattie's user avatar
0 votes

Creating posts with links from a txt file

I think you get errors because you create duplicated posts named as "test". Postcreator function's 1rst argument should be dynamic, hot hardcoded. When you activate the plugin the loop is ...
szoupi's user avatar
  • 1
0 votes

Hide page title on dedicated posts page

With the limited information here, it's hard to point you in the right I'll try my best. Assumptions: You are using the WordPress theme twentytwentythree or newer The best way I've ...
Andrew Derse's user avatar

Top 50 recent answers are included