Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blog redirecting only first blogger blog in the list #45

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

devansh016
Copy link
Member

Issue: Redirection Not Working if Multiple Blogger Blogs are added

This fixes: #41

Problem

The redirection function was only working for the first Blogger domain encountered in the list. Subsequent domains were not being checked, and the function was prematurely redirecting to the home page for all Blogger domains except the first.

Solution

  • Moved the wp_safe_redirect( home_url(), 301 ); out of the main loop.
  • Now if a matching Blogger domain was not found it wouldn't redirect to home page and exit the loop in the first iteration.

Testing

  1. Import at-least 2 blogger blogs and set redirection for them.
  2. Check if the pages for all the blogger blogs are redirecting correctly and not only the first in the list is redirecting correctly.

@devansh016 devansh016 changed the title Fix blog redirecting only first blogger blog in the list correctly Fix blog redirecting only first blogger blog in the list Jul 19, 2024
@devansh016 devansh016 marked this pull request as ready for review July 19, 2024 11:17
@devansh016 devansh016 changed the base branch from master to develop July 23, 2024 10:35
@pavanpatil1
Copy link
Contributor

Verified the PR and it is working fine. The blog redirection is working fine even if there are multiple blog sites added.

twoblogredirection.webm

@devansh016 devansh016 merged commit 3de59d5 into develop Jul 24, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blog redirecting to home page if using plugin for more than 1 blog
3 participants