This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 1. Reset all code snippets to use '<pre><code>' as opening tags. | |
UPDATE wp_posts | |
SET post_content = REGEXP_REPLACE(post_content, '<pre[^>]*>(<code[^>]*>)*', '<pre><code>') | |
WHERE post_status = 'publish' | |
AND post_type = 'post' | |
AND post_content RLIKE '<pre[^>]*>(<code[^>]*>)*'; | |
-- 2. Reset all closing tags. | |
UPDATE wp_posts | |
SET post_content = REGEXP_REPLACE(post_content, '(<\/code>)*<\/pre>>', '</code></pre>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add rel="noopener" to all "A" tags for external links. | |
* | |
* Selection rules: | |
* - "A" tag must have "href" attribute, exclude anchors. | |
* - "href" attribute must not start with a "." | |
* - "href" attribute must not start with a "/" | |
* - "A" tag must not have rel="noopener" set. | |
* - "A" tag must not have rel="noreferrer" set. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
wp search-replace '<pre[^>]*>(<code[^>]*>)*' '<pre><code>' 'wp_posts' \ | |
--regex \ | |
--regex-flags='i' \ | |
--skip-plugins \ | |
--skip-themes \ | |
--skip-packages \ | |
--color \ | |
--include-columns='post_content' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# | |
# Drupal Deployment Script for Platform.sh Environments | |
# ============================================================================== | |
# Authored by osman gormus <[email protected]> on Oct 5, 2021 | |
# | |
# | |
# deploy: | |
OlderNewer