Make category page the wordpress homepage (not blog)

This happens because WordPress doesn’t have provide multi-lingual functionality by default. When you call get_category_link( 22 ), you’ll get exactly that – the link for category with the ID of 22. WordPress isn’t aware that there might be a translation for the term and it should be used instead. The multi-lingual support needs to come … Read more

WordPress post slug redirection

You can use the next PHP code: // NAV: Custom Redirect function wpcoder_custom_redirect() { // Check if the current URL is the one you want to redirect if (is_single() && is_main_query() && get_post_field(‘post_name’) === ‘news-from-new-york’) { // Define the new URL $new_url = home_url(‘/news-from-new-york-2/’); // Get the query string from the current URL $query_string = … Read more

Where to add wp_redirect on frontend pages?

I found that currently this is the only reliable solution: if (is_admin()){ header(‘Location: ‘. get_permalink()); exit(); } else add_action(‘template_redirect’, function (){ wp_redirect(get_permalink()); exit(); }); In the case of backend pages the template_redirect does not seem to be supported. If I use wp_redirect the redirection does not happen (maybe it is a bug) or the function … Read more

Redirect to File attached to a Post using ACF

The action redirect_to_acf_file_url doesn’t exist, at least not in stock WordPress. You’ll need to supply a proper action hook, and it’ll need to be one that happens before any output is sent to the browser. I’d recommend something like init or wp. add_action() takes a hook name and a function name. <?php function redirect_to_acf_file_url() { … Read more

Wp-admin wrongly redirecting on multisite

Solved it adding an annotation to the ingress: nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/use-regex: “true” nginx.ingress.kubernetes.io/configuration-snippet: | rewrite ^(/[^/]+)?(/wp-admin)$ $1$2/ break; rewrite ^(/[^/]+)?(/wp-admin/.*)$ $1$2 break; And changing the pathtype to ImplementationSpecific