Duplicate Content Issue with WordPress Permalink Structure and Primary Categories

function get_current_post_ID() { $postid = get_queried_object_id(); $post_url = get_permalink( $postid ); //wp_redirect( $post_url ); if( has_category(”, $postid) && urldecode(‘https://’.$_SERVER [‘HTTP_HOST’].$_SERVER [‘REQUEST_URI’]) != $post_url ) : wp_redirect( $post_url, 308 ); exit(); endif; } add_action( ‘template_redirect’, ‘get_current_post_ID’ );

Automatic short URL in posts

I installed yourls on a custom short domain. Then added an acf field to posts. Then when a post is added or modified, call yourls API to get the shortlink, and save that link in the custom field add_action(‘acf/save_post’, ‘update_related_posts’, 20); function update_related_posts($post_id) { global $old_field_value; // Check if the save is an auto-save, in … Read more

Leave login URL for my user beautiful

Assuming you’re trying to get rid of the ?redirect_to={url}, you can use the login_url filter to change the login URL, and remove unwanted querystring components with remove_query_arg(): add_filter( ‘login_url’, ‘wpse422493_strip_login_url’ ); /** * Strips `redirect_to` from the querystring. * * @param string $url The login URL. * @return string The filtered login URL. */ function … Read more

All WordPress Website Images Broken

It sounds like a frustrating issue, but there are a few troubleshooting steps you can take to try to resolve the problem: Check File Permissions: Ensure that the file permissions for your images in the hosting file manager are set correctly. They should typically be set to 644 for files and 755 for directories. Incorrect … Read more