Show Post ID on Field Type Post?

Support General Show Post ID on Field Type Post?Resolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #46322
    Andrew TegenkampAndrew Tegenkamp
    Participant

    I'm reading over https://docs.metabox.io/fields/post/ and I'd like to create a Custom Field that is a list of Posts like this, but have the display in the select2 also show the Post ID#. Is that possible?

    We have imported a lot of similar named posts so even if I had to update code I'd be willing to do that knowing it would be overwritten on each MetaBox update for now while we sort it out if this is not a feature that can be overridden. If this is the case do you know where the code for this is?

    Thanks.

    #46325
    PeterPeter
    Moderator

    Hello Andrew,

    The default select type of the post field is select_advanced (select2). If you want to add the post ID to the post title in the list, you can use the filter hook rwmb_post_choice_label. Following the documentation https://docs.metabox.io/fields/post/#filters

    #46361
    Andrew TegenkampAndrew Tegenkamp
    Participant

    Thanks, that worked great!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.