WordPress Post Meta in 10 Minutes | WordPress Metadata and Database Tutorial

Поділитися
Вставка
  • Опубліковано 15 гру 2020
  • In this video, we go over #WordPress post meta and a few #PHP functions to help us manage it.
    WPRocket: wpcasts.tv/go/wprocket
    Code: gist.github.com/alexander-you...
    💖 Become a Patron to show support & get perks!
    / wpcasts
    Sign up for the newsletter. Free course coming soon:
    wpcasts.tv
    *SOCIAL*
    Twitter: / alexanderbyoung
    Facebook: / wpcasts.tv
  • Наука та технологія

КОМЕНТАРІ • 38

  • @solariklipz
    @solariklipz 3 роки тому +1

    I've been looking for a yt channel like yours for so long! Thank you for doing this dude

  • @skeepskeeperson
    @skeepskeeperson 3 роки тому +6

    Next video on user_meta?

  • @alexandrest-cyr1625
    @alexandrest-cyr1625 3 роки тому +2

    Hey Alex, loving these videos! Something I would really like to see before or after you go into demonstrating how these functions work would be a real-life example of how you used these functions for a client :) Or some common use cases would also be awesome

  • @m.o.7661
    @m.o.7661 2 роки тому

    I liked your video, you touched an area in your instruction that is so simple, but people say it in a complicated way. You kept in the lane of not giving more information that was needed for the understanding of Key and value. Thanks, I needed that piece of information. Appreciate your time in setting up the video.

  • @nisarul-dev
    @nisarul-dev 9 місяців тому

    Man!!! Thank you so much... Loved your video.

  • @fvgoya
    @fvgoya 3 роки тому +5

    AMAZING!!! You explain in a very easy way. Love your content man. Is it possible make a part two but integrate with Custom Post Type? Add, delete and update the post meta from the custom post type page. Thanks man!!!

    • @WPCasts
      @WPCasts  3 роки тому +2

      I'll put it on my list!

    • @fvgoya
      @fvgoya 3 роки тому

      @@WPCasts thank you!! 🤘🏻🙂

  • @theman7050
    @theman7050 Рік тому

    Thank you soo much for your contribution to the WP community!
    Stuff like this allows devs to be free of plugins like ACF for simple jobs :D

  • @allanantoni
    @allanantoni Рік тому

    Thanks, in 2 minutos of you video, i solve my problem.

  • @muhammadkhan9938
    @muhammadkhan9938 Рік тому

    Thanks, brother
    your code is very useful in my work. And very important this task was completed for me.
    Thanks a lot

  • @alecn4115
    @alecn4115 2 роки тому

    This video was really useful, thank you so much dude.

  • @harsh98trivedi
    @harsh98trivedi Рік тому

    Super helpful video!

  • @dhruv9963
    @dhruv9963 2 роки тому

    Valuable info, thanks for sharing 👍😊

  • @chankailoon
    @chankailoon 3 роки тому

    Keep up the good works. Very well explained. Subs.

  • @benayoub3524
    @benayoub3524 2 роки тому

    Thank you very much for talking about things so Plugins editors don't say very easily. So they can tax more and more money! Thumb Up For You !

  • @andreasmou6539
    @andreasmou6539 3 роки тому

    As i have said before this is the best yt channel for advanced wp. What about the online lessons? Still waiting !

  • @RajibAhmad
    @RajibAhmad 3 роки тому +1

    very helpful... thanks a lot..

    • @WPCasts
      @WPCasts  3 роки тому +1

      Most welcome!

  • @aspsa6246
    @aspsa6246 3 роки тому

    Thank you for the video. I am using Advanced Custom Fields (ACF) to simplify the process of creating custom fields in WordPress as well as leveraging ACF's ability to layout custom fields in a presentable manner within an editable custom post type. However, I am accessing the content of a custom post with WordPress' get_post_custom function instead of ACF's get_field function. I read about this elsewhere (the source escapes me), and this approach provides value in the event someone deactivates the ACF plugin.
    While playing around with ACF's "group" and "tab" field types in order to design a more user-friendly custom field layout in the post editor's screen, I discovered a problem. Namely, I used the same field names when deleting ACF fields and replacing them within alternative ACF "group" and "tab" contexts. For example, I originally may have had a "About" group with three tabs and each tab having a few fields/sub-fields. Suppose one such field was assigned the ACF field name "product_container". In trying alternate layout designs, I may have created another ACF group (e.g., "Details"), deleted the original "product_container" ACF field within the "About" ACF group and then recreated the "product_container" field within the "Details" ACF group. Unfortunately, when I deleted the original 'product_container' ACF field, its corresponding entry in the WordPress MySQL "post meta" table was retained, which I find to be a strange (default) ACF behavior. Frankly, I do not see any value in retaining a "post meta" record when its correlated ACF custom field is purged.
    Unfortunately, this causes a problem, as the custom post now displays the wrong "product_container" metadata value. I realize ACF has functions analogous to the ones you present in this video. In fact, my guess is these ACF functions wrap the PHP functions you presented here. However, as noted earlier, I am deliberately avoiding the ACF functions in the event someone deactivates the ACF plugin.
    Can you provide some guidance on how best to leverage the PHP functions within the context of meta data created by the ACF plugin? I realize it will require identifying the IDs for the various post meta records generated by ACF, but I wonder if I need to make any changes within the "posts" table, also, in order to avoid the occurrence of orphaned records. The nature of the database relationships becomes further complicated on account of its denormalization. For example, consider this "meta value" value for "product_container": "a:1:{i:0;s:3:"rea";}". This format makes it difficult to trace the meaning of "a", "i" and "s", and, given the value is of type string (as confirmed by the PHP "gettype" function), I need to use a string search/extraction function simply to retrieve the "rea" portion of this string value. It's a clunky design, and, somewhere down the road, I'll need to dive into WP's database API, so that I can design my own tables to my liking.

  • @BuntyWP
    @BuntyWP 3 роки тому

    very nice

  • @BengkelKakiMobil
    @BengkelKakiMobil 2 роки тому

    nice "Bengkel Kaki Mobil Purwokerto"

  • @petruciucur
    @petruciucur 3 роки тому

    Thanks for this lesson. What about query postmeta by slug instead id ? There are situations where need postmeta from different posts.

  • @seansr1953
    @seansr1953 3 роки тому

    Great presentation man. Inspiring. What text editor is that? I couldn't tell. Thought maybe Sublime, but not sure because I am not experienced enough with it or PHP to have recognized it. Either way, 🎅🏻🎄 Merry Christmas and a 🥳🥂 Happy New Year to your and your family sir. ✌🏻

  • @rezarafieirad
    @rezarafieirad 3 роки тому

    very nice. what extensions you used for integrating wordpress in to Vscode?

  • @TheyMadeMonsters
    @TheyMadeMonsters 3 роки тому

    CoOl ViD..! 👍

  • @IbarsDaniel
    @IbarsDaniel 2 роки тому

    Hey buddy, wonderfull tutorial, I was wondering that maybe is also usefull if you have the information about a wp method to get all meta for a particular post. Does that even exist?? Thanks in advance

  • @user-ob3ph6fm5d
    @user-ob3ph6fm5d 3 роки тому

    How can we handle a lot of metadata in WordPress? Say, for a library of photos that need to meet either METS or Dublin Core metadata standards?

  • @khelochagabia
    @khelochagabia 3 роки тому

    Hey Alex, Can you create a video about how to get a freelance project or a remove job as a wordpress developer?

  • @chauhan12341
    @chauhan12341 3 роки тому

    Please make a video on shortcode advanced

  • @kamsamolets
    @kamsamolets 3 роки тому

    hey Alex, can u share with us your VS Code setup for Wordpress ? =) Tnx

  • @chauhan12341
    @chauhan12341 3 роки тому

    Please create video on form submition from frontens

  • @solankiketul5640
    @solankiketul5640 3 роки тому

    Can you please make a tutorial on how to extend the wordpress metadata api for creating custom table. Please, as soon as possible...please

  • @heynaveeen
    @heynaveeen 3 роки тому

    First 😛

  • @wayneshen5201
    @wayneshen5201 3 роки тому

    Hey guys,somehow,when I use add post meta function, it adds multiple same post metas with same meta values in the wp_postmeta table. I don't know why,cant't google the answer.It should be only one meta key with one meta id and meta value

    • @aashishshrestha55
      @aashishshrestha55 3 роки тому

      I guess you need to use update_post_meta instead of add_post_meta

  • @mattsayle
    @mattsayle 3 роки тому

    What