unable to set uploaded file via frontend form as featured image

first of all you need to add enctype=”multipart/form-data” to make your form support file uploads. So far you’ve attached the image to the post, but you haven’t inserted them. Try something like this <?php $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => null, ‘post_parent’ => $post->ID ); $attachments = get_posts($args); if ($attachments) … Read more

Custom 404 error does not always appear

WordPress doesn’t receive those requests, so the server 404 displays. If you want WordPress to handle all 404s, use mod_rewrite Pretty Permalinks rather than PATHINFO permalinks. The requirements are detailed in Using Permalinks.

Switch-Case and user_role

You missed break statement This is how switch case works switch ($i) { case “apple”: echo “i is apple”; break; case “bar”: echo “i is bar”; break; case “cake”: echo “i is cake”; break; }

two body tags on all WP pages regardless of theme

I think this is the browser modifying the DOM due to a weird character you have in your body tag. When I view source in Firefox, I’m seeing the “character not recognized” box next to the body tag. This is also visible in Firefox inspector. Modern browsers automatically fix issues in your HTML for you … Read more

Replace TinyMCE with Custom Built Editor

You can do that with js/jquery if you want : $(‘#postdivrich’).hide().after(your custom editor div); You can add inputs with jquery and save them with : add_action(‘save_post’, ‘save_the_post’); function save_the_post(){ global $post; update_post_meta($post->ID, ‘field_name’, $_POST[‘field_name’]); } Or use a metabox and replace standard editor with it (width jquery). Hope this help someone 🙂

Pagination not displaying

You need to add your query variable to the global used on the function, in that case “$wp_query“, just like that: <?php $yourQuery_args = [‘posts_per_page’ => ‘7’,]; $yourQuery = new WP_Query( $yourQuery_args ); $wp_query = $yourQuery; get_template_part(‘pagination’); ?>