- 20
- 06
- 2016
Woocommerce bulk price update
Kategorisi : Wordpressupdate w_postmeta set meta_value = meta_value * 1.25 where meta_key=’_price’
update w_postmeta set meta_value = meta_value * 1.25 where meta_key=’_price’
functions.php'ye bu kodları ekliyoruz.
add_action ('init', 'remove_featured_images' );
function remove_featured_images () {
global $wpdb;
// The following query will only unset the featured image, it will not delete it.
$wpdb->query( "
DELETE FROM $wpdb->postmeta
WHERE meta_key = '_thumbnail_id'
" );
}
$post_if = $wpdb->get_var(“SELECT count(post_title) FROM $wpdb->posts WHERE post_title = ‘some text'”);
if($post_if < 1){
echo “var”;
} else {echo “yok”;}
Toplu tarih değişimi – wordpress
UPDATE wp_posts SET post_date = ‘2014-08-04 17:02:52’ WHERE post_type = ‘post’ AND ID LIKE ‘%63%’
Bir kategorideki tüm yazıları silmek için gerekli sql kodumuz :
delete a,b,c,d
FROM w_posts a
LEFT JOIN w_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN w_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN w_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
LEFT JOIN w_terms e ON ( e.term_id = d.term_id )
WHERE e.term_id =1
SELECT a.ID, a.post_title, a.post_type, a.post_status FROM wp_posts AS a INNER JOIN ( SELECT post_title, MIN( id ) AS min_id FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY post_title HAVING COUNT( * ) > 1 ) AS b ON b.post_title = a.post_title AND b.min_id <> a.id AND a.post_type = 'post' AND a.post_status = 'publish' ------------------------------------------DELETE a.* FROM wp_posts AS a INNER JOIN ( SELECT post_title, MIN( id ) AS min_id FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY post_title HAVING COUNT( * ) > 1 ) AS b ON b.post_title = a.post_title AND b.min_id <> a.id AND a.post_type = 'post' AND a.post_status = 'publish'
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
DELETE a.*
FROM wp_posts AS a
INNER JOIN (
SELECT post_title, MIN( id ) AS min_id
FROM wp_posts
WHERE post_type = ‘post’
AND post_status = ‘publish’
GROUP BY post_title
HAVING COUNT( * ) > 1
) AS b ON b.post_title = a.post_title
AND b.min_id <> a.id
AND a.post_type = ‘post’
AND a.post_status = ‘publish’
Her insert işleminden sonra taxonomy’i “_children” ile silmemiz gerekiyor. Mesela taxonomy = kategori ise ;
delete_option(“kategori_children”);
yazıyoruz.
wp_insert_term(
$kategori_adi,
‘category’,
array(
‘description’ => $aciklama,
//’slug’ => $slug,
‘parent’ => 0,
)
);
delete_option(“category_children”); //
http://ornek.com/
http://ornek.com/index.php
http://www.ornek.com/index.php
yönlendirmeyi engellemek için :
kullandığınız temadaki functions.php içerisine
remove_filter(‘template_redirect’,’redirect_canonical’);
kodunu ekliyoruz.
Php, ajax, jquery, mootools web programlama. Linux, apache, lamp sunucu yönetimi. Cpanel, plesk, lxadmin panel kurulumlari.
22 / 01 / 2021, 02:25:32
Web yazilim, grafik
barbetto.com