upskill-event-manager/scripts/list-and-fix-pages.sh
bengizmo 81190ec4a0 Fix legacy URL redirects being intercepted by access control
- Added is_legacy_url() check in access control to allow redirects to happen first
- Legacy URLs like /hvac-dashboard/ now properly redirect to /trainer/dashboard/
- Prevents authentication check from blocking legacy URL redirects

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-28 19:45:43 -03:00

47 lines
No EOL
2.1 KiB
Bash
Executable file

#!/bin/bash
echo "=== Listing and Fixing HVAC Pages ==="
ssh roodev@146.190.76.204 << 'ENDSSH'
cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html
echo "=== Current HVAC Pages ==="
wp post list --post_type=page --meta_key=_wp_page_template --meta_value='hvac%' --fields=ID,post_title,post_name,post_content --format=table
echo -e "\n=== Searching for HVAC pages by title ==="
wp post list --post_type=page --s="trainer" --fields=ID,post_title,post_name,post_content --format=table
echo -e "\n=== Searching for master pages ==="
wp post list --post_type=page --s="master" --fields=ID,post_title,post_name,post_content --format=table
echo -e "\n=== Finding pages by URL path ==="
# Find trainer dashboard page
trainer_dash_id=$(wp db query "SELECT ID FROM wp_posts WHERE post_name='dashboard' AND post_parent=(SELECT ID FROM wp_posts WHERE post_name='trainer' AND post_type='page') AND post_type='page'" --skip-column-names)
if [ -n "$trainer_dash_id" ]; then
echo "Found trainer dashboard page ID: $trainer_dash_id"
wp post update "$trainer_dash_id" --post_content="[hvac_dashboard]"
echo "✅ Updated trainer dashboard"
fi
# Find master dashboard page
master_dash_id=$(wp db query "SELECT ID FROM wp_posts WHERE post_name='dashboard' AND post_parent=(SELECT ID FROM wp_posts WHERE post_name='master-trainer' AND post_type='page') AND post_type='page'" --skip-column-names)
if [ -n "$master_dash_id" ]; then
echo "Found master dashboard page ID: $master_dash_id"
wp post update "$master_dash_id" --post_content="[hvac_master_dashboard]"
echo "✅ Updated master dashboard"
fi
# Find registration page
registration_id=$(wp db query "SELECT ID FROM wp_posts WHERE post_name='registration' AND post_parent=(SELECT ID FROM wp_posts WHERE post_name='trainer' AND post_type='page') AND post_type='page'" --skip-column-names)
if [ -n "$registration_id" ]; then
echo "Found registration page ID: $registration_id"
wp post update "$registration_id" --post_content="[hvac_trainer_registration]"
echo "✅ Updated registration page"
fi
# Clear cache
wp cache flush
wp breeze purge --cache=all
echo -e "\n✅ Script complete"
ENDSSH