add an option to the read page

There’s no hook in WordPress that allows you to add a third option there. So you need to add a new option at the bottom as described in that post you linked to. Unless you add something using JavaScript, which I don’t recommend. I think that makes more sense anyway. In the latest version of … Read more

WordPress broken after changing URL

Your config in WP is generally correct, but you have “forwarding” enabled at Namecheap, where they just redirect to your IP. Set it up as a real DNS A entry pointing to the IP. Then set up your IIS to listen at port 80. For reference, here’s how I debugged it (I’ll replace your actual … Read more

Query for specific custom field

Data associated to a user can be saved in user meta. Save the recipe post IDs in an array for the user. $my_favs = array( 42, 23, 99 ); update_user_meta( get_current_user_id(), ‘user_favs’, $my_favs ); Then to query all recipe posts with those IDs, pass the array as the post__in argument to WP_Query: $my_favs = get_user_meta( … Read more

Editing a post template

can you try changing these lines: ‘order_by’ => ‘custom’, ‘meta_key’ => ‘Last Name’, in each of the above sections with this code: ‘meta_query’ => array( ‘relation’ => ‘AND’, ‘last_name_sort’ => array( ‘key’ => ‘last_name’, ‘compare’ => ‘EXISTS’, ), ‘first_name_sort’ => array( ‘key’ => ‘first_name’, ‘compare’ => ‘EXISTS’, ), ), ‘orderby’ => array( ‘last_name_sort’ => ‘ASC’, … Read more

Is it necessary to prefix theme_mod, section id and panel id in the customizer?

Short answer: Yes. WordPress is a system that allows for many parts and custom configuration, WP_Customize_Manager::add_setting() fits perfectly into that. But you’re not the only one trying to customize this specific WordPress instance, so are all the (activated) plugins and themes. To make sure, you don’t overwrite another functionality and your own does not get … Read more

Prevent Multisite from creating sample page, sample post and sample comments

When you create a new site with multisite WP does not automatically change the context. So your action is added to the current site, not the new site. You have to switch first. Like this: add_action (‘wpmu_new_blog’, ‘wpse296303_delete_wordpress_defaults’, 100, 1); function wpse296303_delete_wordpress_defaults ($blog_id, $user_id, $domain, $path, $site_id, $meta) { // Switch to the newly created … Read more

Add or Create Custom Structure Tags to Permalink

Here is a random example from one of my slides. Note: tag supposes to be in your type permastruct. random itself will need to be added to public query vars, but let this be a homework, and analyzed somehow. add_rewrite_tag( ‘%random%’, ‘(.+)’, ‘random=’ ); add_filter( ‘available_permalink_structure_tags’, function ( array $tags ) : array { $tags[‘random’] … Read more