79670672

Date: 2025-06-18 12:59:03
Score: 0.5
Natty:
Report link

The get_stylesheet_directory_uri() function builds the URI using the value stored in the database for the site URL, not just what's in wp-config.php.

Here are steps:

1. Update URLs in the database

You likely need to update any hardcoded URLs in the database (common after a migration). Use a tool like WP-CLI or a plugin like Better Search Replace to update old URLs:wp search-replace 'http://oldsite.com' 'https://somewebsite.com' --skip-columns=guid

2. Clear Caches

=>Clear WordPress cache if you're using a caching plugin (e.g. W3 Total Cache, WP Super Cache).

=>Clear browser cache.

=>Clear object cache if using Redis or Memcached.

3. Flush Rewrite Rules

=>Go to Settings > Permalinks and click Save Changes.

4. Check for Hardcoded Values

Inspect your theme’s functions.php or any custom plugin code to ensure the old URL isn’t hardcoded

=>define('THEME_URI', 'http://oldsite.com/wp-content/themes/your-theme');

Once the database references are correctly updated, get_stylesheet_directory_uri() should automatically reflect the new domain.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: sweta maliye