Logout button in menu without “wp” in links

You can use wp_logout_url() function for logout link. It will automatically add nonce to the url. Try this code: add_action(‘template_redirect’, function() { if (empty($_SERVER[‘REQUEST_URI’])) return; $uri = $_SERVER[‘REQUEST_URI’]; if (preg_match(‘#^/log-out/?$#’, $uri, $matches) === 1) { $logout_url = str_replace(‘&’, ‘&’, wp_logout_url()); wp_safe_redirect($logout_url); die; } }); If you do not want to use wp_logout_url(), then try to … Read more

Remove placeholder from core/image in InnerBlocks template

Unfortunately, there is no easy solution. You could use editor.BlockEdit hook to change default core/image Edit component, and copy the code from current trunk version, and change there to not use MediaPlaceholder, but MediaUpload wrapped in MediaUploadCheck. However, that would create problem that all core/image blocks would be changed and it would not be futureproof, … Read more

Sub-pages of Custom Taxonomies

I’d do it something like this. First, register a new query var, so WP will acknowledge its existence: add_filter( ‘query_vars’, function( $query_vars ) { $query_vars[] = ‘cast’; return $query_vars; }); Next, add a rewrite rule, which converts the pretty permalink version of your URL behind the scenes: add_action( ‘init’, function() { add_rewrite_rule( ‘^movie/([^/]+)/cast/?$’, ‘index.php?movie=$matches[1]&cast=1’, ‘top’ … Read more

Submenu items not working anymore

You’re right, this is odd behavior. I’m curious, what would happen if you added an anchor link directly on the ‘On the Block’ page (ie, #play)? Not suggesting this as a solution, just trying to establish whether anchor links will work on the page if not included as part of the navigation.

Can WordPress updates take down site functions?

As stated in the comments a perfect prediction is not possible, but: I’ve seen tons of similar scenarios and almost all of them failed the update. With the number of plugins your site is using, it is very likely that at least one won’t be compatible with a newer WP, so create a test environment … Read more

Sorting a custom post type in pre_get_posts

You can add a filter on posts_clauses to; left join additional columns for each meta filter add order by clause base on those column values. Something like below should work, assuming your meta key is start_date and the value has the actual date format Y-m-d and your post type is talks add_filter( ‘posts_clauses’, function ($clauses, … Read more