List posts in a given category

You are already passing category in $args. so not need to use get_categories(). You can use below code. $args = array( ‘cat’ => 5, ‘posts_per_page’ => -1, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’ ); $custom_loop = new WP_Query($args); if ($custom_loop->have_posts()) { echo “<ul>”; while ($custom_loop->have_posts()) { $custom_loop->the_post(); echo ‘<li><a href=”‘ . get_permalink() . ‘”>’ . … Read more

Adding dropdown select meta box to custom post type – seems restAPI is interfering

But I don’t understand: why does the mere act of checking off that a post type is visible to restAPI cause wordpress’s backend editor to go into a completely different mode of operation? WordPress 5.0 introduced the Block Editor. This is an entirely new post editing screen and method of editing posts. It works by … Read more

Multisite – Get current post id

try this $sites = get_sites(); global $switched; /** @var WP_Site $site */ foreach ($sites as $site) { if ( $site->archived || $site->spam || $site->deleted ) { continue; } switch_to_blog( $site->blog_id ); $all_posts = get_posts(‘category=-3&numberposts=6&orderby=post_name&order=DSC’); ?> <ul> <?php foreach($all_posts as $post) : setup_postdata($post);?> <li> <a href=”https://wordpress.stackexchange.com/questions/354427/<?php echo get_page_link($post->ID); ?>” title=”<?php echo $post->post_title; ?>”><?php echo $post->post_title; ?></a> … Read more

Can’t Delete or find a blog post (unknown)

We don’t really know why this post is there but inaccessible by you, but for anyone having this issue here’s how you can attempt to remove it. You would go to any other post in your dashboard/admin, to edit it. In your browser URL bar you’d look for this aspect of the URL: post.php?post=xxxx&action=edit Then, … Read more

Add icon/badge next to posttitle of specific category

This will depend on how your theme is structuring the templates for single.php (individual post view) but I’ll show you what to look for and how to apply via CSS. So from a theme I’m working on, this is where the category gets included in the post: <article id=”post-3417″ class=”post-3417 post type-post status-publish format-standard hentry … Read more

Uppercase first sentence in every post

Welcome to WPSE. So I can’t write all the code for you, but I would suggest you look at these main pieces, and then come back here or make new questions if you have followup questions: To alter the content of a post before it’s printed to the screen you could use the the_content filter. … Read more