Skip to content

Instantly share code, notes, and snippets.

@flusher
Created April 18, 2023 14:03
Show Gist options
  • Save flusher/b03657071c2ce05783b5bcc0e7710cfe to your computer and use it in GitHub Desktop.
Save flusher/b03657071c2ce05783b5bcc0e7710cfe to your computer and use it in GitHub Desktop.
Massively convert absolute links to relative links with in menu items in Drupal 8+ (SQL)
UPDATE menu_link_content_data SET rediscover=1,changed=unix_timestamp(),link__uri = REPLACE(link__uri, 'https://www.example.com', 'internal:');
UPDATE menu_link_content_field_revision SET changed=unix_timestamp(),link__uri = REPLACE(link__uri, 'https://www.example.com', 'internal:');
# /!\ Do not forget to clear cache (drush cr) !
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment