Repost post on specific date every year

Rather than re-post the posts, we can create a custom query for the current day’s post regardless of year. We use current_time to get the current day and month according to the site’s timezone settings, then we create a new query containing date parameters for month and day. We don’t specify a year, so it’ll … Read more

prevent showing posts of an specific category in admin posts section

You can use the pre_get_posts action to affect any queries, both in frontend and admin. In your case you should make sure you affect only admin queries and you can even use get_current_screen to narrow it down further. Here’s an example that would modify the query only on the regular posts page: add_action (‘pre_get_posts’, ‘wpse311946_restrict_cats’); … Read more

WordPress Delete hook with wp_delete_post function?

wp_delete_post() always triggers before_delete_post – the problem must be that you’re hooking your function conditionally (i.e. not all the time). before_delete_post only gets triggered if you’re actually deleting the post permanently, not just trashing it. If you need to listen for trashing too, use wp_trash_post.

loop not displaying posts on custom template page

Make a copy of press.php and rename it to home.php. The page you selected “Press” to be the designated page for your posts in the dashboard under, Settings > Reading > Posts Page: [Press] …now falls under the control of the template hierarchy as listed by Milo. First WordPress will look for the existence of … Read more