Linux cesa-www-main 6.1.0-49-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
Apache/2.4.68 (Debian)
Server IP : 10.218.0.2 & Your IP : 216.73.216.28
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
cesa.co.za /
scripts /
wordpress /
Delete
Unzip
Name
Size
Permission
Date
Action
wp-dev-post-migrate-fix.sh
3.53
KB
-rw-r--r--
2026-07-20 12:58
wp-files-backup.sh
9.16
KB
-rw-r--r--
2026-07-20 13:03
Save
Rename
#!/usr/bin/env bash # Run on the DEV WordPress server after importing LIVE database into c37_cesa_wp. # Fixes URLs, multisite domain, caches, and Elementor — restores header/menu display. # # Usage (from WordPress root on dev, e.g. clients/client37/web63 or site docroot): # bash /path/to/cesa-main/scripts/wordpress/wp-dev-post-migrate-fix.sh # # Requires: WP-CLI (wp) and PHP. Set WP_PATH if not current directory. set -euo pipefail WP_PATH="${WP_PATH:-$(pwd)}" DEV_URL="${DEV_URL:-https://cesa.devstage.co.za}" LIVE_URL_HTTPS="${LIVE_URL_HTTPS:-https://www.cesa.co.za}" LIVE_URL_HTTP="${LIVE_URL_HTTP:-http://www.cesa.co.za}" LIVE_URL_ALT="${LIVE_URL_ALT:-https://cesa.co.za}" if [[ ! -f "$WP_PATH/wp-config.php" ]]; then echo "ERROR: wp-config.php not found in WP_PATH=$WP_PATH" >&2 exit 1 fi if ! command -v wp >/dev/null 2>&1; then echo "ERROR: WP-CLI (wp) is required. Install from https://wp-cli.org/" >&2 exit 1 fi wp_cli() { wp --path="$WP_PATH" "$@" } echo "==> WordPress path: $WP_PATH" echo "==> Target DEV URL: $DEV_URL" echo "==> 1. Core site URLs" wp_cli option update home "$DEV_URL" wp_cli option update siteurl "$DEV_URL" echo "==> 2. Multisite domain (wp_site / wp_blogs)" # Safe for single-site multisite install (blog_id 1) wp_cli db query "UPDATE wp_site SET domain='cesa.devstage.co.za' WHERE id=1;" 2>/dev/null || true wp_cli db query "UPDATE wp_blogs SET domain='cesa.devstage.co.za' WHERE blog_id=1;" 2>/dev/null || true echo "==> 3. Search-replace LIVE → DEV (serialized-safe)" for pair in \ "$LIVE_URL_HTTPS|$DEV_URL" \ "$LIVE_URL_HTTP|$DEV_URL" \ "$LIVE_URL_ALT|$DEV_URL" \ "www.cesa.co.za|cesa.devstage.co.za" \ "http://cesa.co.za|https://cesa.devstage.co.za" \ "https://cesa.co.za|$DEV_URL"; do from="${pair%%|*}" to="${pair##*|}" echo " replace: $from → $to" wp_cli search-replace "$from" "$to" --all-tables --precise --recurse-objects --report-changed-only || true done echo "==> 4. Flush rewrite rules and caches" wp_cli rewrite flush --hard wp_cli cache flush wp_cli transient delete --all 2>/dev/null || true echo "==> 5. Elementor regenerate CSS and data" if wp_cli plugin is-active elementor; then wp_cli elementor flush-css 2>/dev/null || wp_cli eval 'if (class_exists("\\Elementor\\Plugin")) { \\Elementor\\Plugin::$instance->files_manager->clear_cache(); echo "elementor cache cleared\n"; }' fi if wp_cli plugin is-active elementor-pro; then wp_cli elementor-pro flush-css 2>/dev/null || true fi echo "==> 6. Theme / menu diagnostics" echo " Active theme: $(wp_cli option get stylesheet)" echo " Nav menus:" wp_cli menu list 2>/dev/null || true echo " Theme Builder conditions (header):" wp_cli option get elementor_pro_theme_builder_conditions 2>/dev/null | head -c 500 || echo " (not set or not Elementor Pro)" echo " Published nav_menu_item count: $(wp_cli post list --post_type=nav_menu_item --post_status=publish --format=count 2>/dev/null || echo '?')" echo "==> 7. Verify homepage HTML contains main menu" MENU_COUNT=$(curl -sL "$DEV_URL/" | grep -c 'menu-item-' || true) echo " menu-item-* occurrences on homepage: $MENU_COUNT" if [[ "${MENU_COUNT:-0}" -lt 10 ]]; then echo "" echo "WARNING: Main navigation still missing in HTML." echo " → WP Admin → Templates → Theme Builder → Header" echo " → Ensure header template (e.g. ID 1822) is assigned to Entire Site" echo " → Edit header → ElementsKit Nav Menu → Menu = Main Site" echo " → Elementor → Tools → Regenerate CSS & Data" fi echo "" echo "Done. Open $DEV_URL and hard-refresh (Ctrl+Shift+R)."