• Hi everyone,
    I’m working on my new gaming website and I’d like to ask something that I really have no idea how to make it work.

    Since I’m doing a game database, I’ve created a custom post type called “Game” that contains information about a game. Every field is managed with Advanced Custom Field (free), relationship included. I can associate a post with a game so I can see its info in the article sidebar. Also, by doing this, when I open a game page, WordPress shows every post that is associated to.

    Now, here’s the tricky question. Considering that I have 17K posts on my website, is there any way to automatically associate a post with a game by, maybe, using a tag? I’ve seen some websites with ACF doing this, so I thought that there’s a way somehow. I probably can’t do something like this with its relationship field directly, and I’m not even sure if ACF is needed, so I’m asking here (if it’s correct).

    If you need more info, please comment here!

    Thanks in advance.

    • This topic was modified 2 years, 11 months ago by alexzan.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You could relate one post to another type through a custom field or post meta value (they’re the same thing by different names). You’d be expected to manually enter the appropriate data in a field for the purpose on the post’s edit screen. Data entered into such fields will be saved in the proper location. It’s unclear how you would fully automate the process to avoid such manual entry. To be fully automated, code would need to somehow determine on its own what game should be related to the current post.

    You can use the default custom field meta box to save data. It’s not very user friendly, but it works. The fields you can add via ACF are nicer and more user friendly, but the end result is the same. Once the data is saved by whatever means, it could be used on the post’s front end page to automatically show a link to the relevant game page.

    MK

    (@mkarimzada)

    I completely agree with @bcworkz. However, to add on his suggestions and specifically to decrease the manual entry, I would create a list of tags before hand, then create a function to search for tag value inside game title or game/post content – if found keywords matched the tag, then programmatically assign the tag to game/post.

    I hope this helps.

    Thread Starter alexzan

    (@alexzan)

    @bcworkz I already relate a post with a game manually. As you said, what I want to do is automate the process for the old posts.

    @mkarimzada That’s a good suggestion, thank you. I always assign a post to a tag with the game title, so this is not a problem. I’ll look into it and I’ll let you know!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Relate automatically a default post with a custom post type “post”’ is closed to new replies.