Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- When switching syntax highlighters this comes in handy to change the shortcode used in posts and comments. For example, changing [code lang="php"] to <pre lang="php">. You can add other languages, these are the only two I ever used.
- Back up your database first!
- Using phpMyAdmin, goto the SQL tab, and enter these lines one by one. (don't enter the description of each line)
- For code in post content, this handles php, css and regular [code] tags without language added.
- // changes post content from [code lang="php"] to <pre lang="php">
- UPDATE `wp_posts` SET `post_content` = replace(post_content, '[code lang="php"]', '<pre lang="php">')
- // changes post content from [code lang="css"] to <pre lang="css">
- UPDATE `wp_posts` SET `post_content` = replace(post_content, '[code lang="css"]', '<pre lang="css">')
- // changes post content from [code] to <pre>
- UPDATE `wp_posts` SET `post_content` = replace(post_content, '[code]', '<pre>')
- // changes post content from [/code] to </pre>
- UPDATE `wp_posts` SET `post_content` = replace(post_content, '[/code]', '</pre>')
- For code in comments, this handles php, css and regular [code] tags without language added.
- // changes comments from [code lang="php"] to <pre lang="php">
- UPDATE `wp_comments` SET `comment_content` = replace(comment_content, '[code lang="php"]', '<pre lang="php">')
- // changes comments from [code lang="css"] to <pre lang="css">
- UPDATE `wp_comments` SET `comment_content` = replace(comment_content, '[code lang="css"]', '<pre lang="css">')
- // changes comment content from [code] to <pre>
- UPDATE `wp_comments` SET `comment_content` = replace(comment_content, '[code]', '<pre>')
- // changes comment content from [/code] to </pre>
- UPDATE `wp_comments` SET `comment_content` = replace(comment_content, '[/code]', '</pre>')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement