php


Wordpress SQL insert string into custom fields


I have several thousand posts in a custom post type called clothing which have a custom field called wpcf-translation
I need to insert a string into every single post's wpcf-translation custom field.
But I couldn't find anything on the internet. So my question is, is there an SQL query I can use to insert a string into every single post's custom field wpcf-translation in custom post type clothing?
Thanks
Based on your comment : I don't think the field is serialized. , the following should get the job done
$args = array(
'post_type' => 'clothing',
'posts_per_page' => -1,
);
$query = new WP_Query( $args );
while( $query->have_posts() ) : if( $query->have_posts() ) : $query->the_post();
update_post_meta($post->ID, 'wpcf-translation' , 'your string here');
else :
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
endif;
endwhile;
wp_reset_postdata();
Ensure that you have a backup in place in case things go awry. Code created on the fly, so might need some fine tuning.

Related Links

FFMPEG (2.5.7 ) Progress Bar from PHP
How to Display Sequence Random Data like the result before on MySQL using PHP?
Does single multiple INSERT in MySQL give a high difference in speed when you insert just several rows?
Phalcon library class calling a function within another
How Can I reduce view calls on Couchbase?
Add active Class for each img element
CakePHP is version X compatible with PHP Version Y
Compile C code on Wamp Server
How to explode an array from a string?
Google OpenID Connect: Receiving a 500 error when supplying the “max_age” parameter to an authentication request
Pass array as parameter to php script
Using “a href” inside echo [closed]
PHP get value of one column in array
Namespace “src\AppBundle\Entity\YesNo” does not contain any mapped entities.
Order French Language in ABC with MySQL
Laravel 5 TokenMismatchException on PHP 5.6.9

Categories

HOME
hpoo
events
typelite
kendo-dropdown
concurrency
antd
tcsh
tcp
clone
eddystone
yahoo
fasm
mailmerge
angular4
mailgun
global-variables
reselect
rest-assured
pygobject
uima
scala-ide
xsl-fo
scheduled-tasks
jitsi
conda
ratio
prompt
uri
sap-lumira
django-import-export
toad
python-2.x
series
sql-execution-plan
advanced-filter
ms-media-foundation
nest
payeezy
directfb
char-pointer
pdfminer
formsauthenticationticket
redgate
spinner
django-smart-selects
selenide
data-uri
word-cloud
music21
dredd
cloudwatch
knockout-2.0
phppgadmin
winston
sigsegv
maven-jaxb2-plugin
glassfish-4.1
gawk
portal
controllers
groovyfx
powerpoint-2013
django-redis
diawi
grinder
godeps
msgpack
sqlbase
cache-manifest
console.log
whitespace-language
prism-4
signed
ssmtp
htmltidy
sql-processor
xml-signature
zend-search-lucene
xmi
windows-taskbar
ctp
hyphen
xsd2code
mp4parser
void-pointers
jquery-cycle
towers-of-hanoi
onconfigurationchanged
airprint
activestate
eai
accumulator
database-cloning
chronic
parentid

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile