Why is a wp function used in current PHP namespace’s callback not resolved to global scope?

From your comment: Apparently the function can indeed not be used on the frontend in wp (see here), can anyone confirm this? I can confirm that the post_exists() function can be used on the front-end, but you need to manually load the file that defines the function, which is wp-admin/includes/post.php — see the “File: <path>” … Read more

Create a custom posts page

When you select a page as your blog page, the template that WordPress is looking for is the home.php file. You should really check out the Template Hierarchy from the WordPress documentation as these things are really WordPress basic knowledge. Check out the Template Hierarchy here: https://developer.wordpress.org/themes/basics/template-hierarchy/

Automatically add images to a menu

I guess you need this function get_the_post_thumbnail_url($menu->object_id); (provided menu item is not a custom link) $menu->ID is not the id of the post/page it is linking to. About calling meta yes it is also possible $image_url = get_post_meta( $menu->object_id, ‘meta_key’, true );

WordPress bulk category select when publishing post

The default function that renders the categories meta box is post_categories_meta_box – it doesn’t have any internal hooks we can use to inject our own HTML, so let’s create our own meta box handler and just use the function internally: function wpse_406861_post_categories_meta_box( $post, $args ) { post_categories_meta_box( $post, $args ); echo <<<HTML <label> <input type=”checkbox” … Read more

Specific colours for wordpress author ids

You can check if post’s author has Administrator role like this (and output markup accordingly): if( author_can( get_the_ID(), ‘administrator’ ) ) { // author is admin } else { // author is not admin } See Roles and Capabilities if you want to check for something more specific than general role.