e7traf-host
Forum Replies Created
-
Forum: Hacks
In reply to: remove all img tags from post_contenty latest code is
function remove_images_form_past_posts() { if ( get_transient('images_removed_from_past') ) return; $args = array( 'post_type' => 'post', 'year' => 2013, 'monthnum' => 9, 'day' => 27, 'post_status' =>'publish', 'category' => 30, 'post_author' => 3, 'nopaging' => 1 ); $posts = get_posts( $args ); if ( $posts ) { foreach ( $posts as $post ){ setup_postdata( $post ); $newcontent = preg_replace('/<img[^>]+\>/i', '', $post->post_content); $newpost = array( 'ID' => $post->ID, 'post_content' => $newcontent); wp_update_post($newpost); } wp_reset_postdata(); set_transient('images_removed_from_past', 1); } } add_action('admin_init','remove_images_form_past_posts');
Forum: Hacks
In reply to: remove all img tags from post_content@bcworkz
i will go with my code to update the past posts then i wil go with a new way to prevent thisbut please help me to fix my code
The code above is perfect & do the job but have one problem: this code is unfortunately update 1 post only although the $args is matching 9 posts.
I have tested the get_posts alone & it is working perfectly & executing 9 posts. I have stopped the WP_super_cache plugin & also no way. I have tried to change “set_transient $value from 1 to 9 with no way.
Any ideas!
Forum: Hacks
In reply to: remove all img tags from post_contentso does you mean that if i edited wp-includes/kses.php & removed img from $allowedposttags this will prevent any future img ?
iam thinking about another thing what your opinion in this?
<?php function remove_images_form_past_posts() { if ( get_transient('images_removed_from_past') ) return; $today = getdate(); $query = new WP_Query( 'year=2013 & monthnum=9 & day=20 & post_type=post & author=-1 & post_status=publish' ); $query = get_posts('nopaging=1'); if ( $query ) { foreach ( $query as $post ) { $newcontent = preg_replace('/<img[^>]+\>/i', '', $post->post_content); $newpost = array( 'ID' => $post->ID, 'post_content' => $newcontent); wp_update_post($newpost); } set_transient('images_removed_from_past', 1); } } add_action('admin_init','remove_images_form_past_posts'); ?>
Forum: Hacks
In reply to: remove all img tags from post_contenti have edited your REGEX to my needs but mysql doesn’t support REGEX with replace statement
so i will go with the second solution
Forum: Hacks
In reply to: remove all img tags from post_contentcould you please update your REGEX to achieve the goal for me?
Forum: Hacks
In reply to: remove all img tags from post_contentnow iam going with your advice “looping all posts” but i have 2 problems to do this please see this
Forum: Hacks
In reply to: remove all img tags from post_contentyour sql query is very very good but your REGEX have one problem it is matching from the begining of <img to the end of the line so if i have any other data like html or text in the same line it will also replaced.
please test it in:
https://gskinner.com/RegExr/Forum: Hacks
In reply to: remove all img tags from post_content@jahjah22
iam already doing this but i neeed to completly remove it from the databse because i have more than 200K post if i delete all img tags from my database i will save a lot of database size so my site loading speed will increaseForum: Fixing WordPress
In reply to: my wordpress load twicethe problem is the page is loaded 2 times every visit if this resolved the load time will decrease 35%
i tried every cache plugins not helped .. so i need to fix the main problem
thanksit is not exactly theme issue , it is a timeout out issue may be from wordpress . so any timeout function available may be cause this issue.
in the first i think that this is agodaddy issue because alot of people in godaddy have it from 2 days but after test it in another host provider i knows that it is not from godaddy .
so i tried to browse all my theme files & find a timeout function when i deleted it or set the timeout=-1 the issue is fixedit is not a duplicator issue it is a theme issue
i have reslove it
iam soory for inconvenienceForum: Fixing WordPress
In reply to: "Oops!!! Page Not Found" Boxsahifa premium theme but i made alot of changes on it
Forum: Fixing WordPress
In reply to: "Oops!!! Page Not Found" Boxin my case the problem is on the theme
but i can’t remove it i have worked to make it for more than 10 days & the site not for me it is for one of clientsany suggestions ?
Forum: Fixing WordPress
In reply to: "Oops!!! Page Not Found" Boxvery thanks fot this information . now i will check this
iam using this plugins :
1-feedwordpress
2-feedwordpress SIC
3-feedwordpress add attribution
i think the three havn’t problem becuase i used it before on the same hosting account in godaddy
4-recent post slider
5-facebook comments
6-wp-forecast
7-wp-importer
in your opinion which one caused thisForum: Fixing WordPress
In reply to: "Oops!!! Page Not Found" Boxnow i see that the problem is fixed in your site . how you fix it ?