Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get meta value by meta id

Tags:

wordpress

Example, I have a post's meta_key is 'name', meta_value is 'Jason',
and this meta_id in MySQL is 128

How can I get this meta_value by meta_id ?

like image 598
user2133682 Avatar asked Jan 20 '26 09:01

user2133682


1 Answers

The best way to do this is to use WordPress's built-in function, get_metadata_by_mid().

So in your case:

$value = get_metadata_by_mid( 'post', 128 );
like image 196
J.D. Avatar answered Jan 22 '26 01:01

J.D.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!