How to remove inline CSS from post together in WordPress (WP)?
Sometimes, we need to use inline CSS in our website pages. But in some cases, we need to remove inline CSS from all posts. In such cases, we need to change the CSS one by one in each post.
Here, the best solution is to remove the inline CSS together by using the following code.
Code of removing inline CSS from WP Pages
1 2 3 4 5 |
add_filter('the_content', function( $content ){ //--Remove all inline styles by fazal rehman shamil-- $content = preg_replace('/ style=("|\')(.*?)("|\')/','',$content); return $content; }, 20); |
You can insert this code in functions.php file.
Latest posts by Prof. Fazal Rehman Shamil (see all)
- List of Public service commissions - August 31, 2020
- Comparison of fee structure of Pakistani Universities - June 1, 2020
- Past Guess Paper of Auditing - May 12, 2020