Auto-add post ID as a value in postmeta table
-
I’d like to automatically add an entry to the postmeta table for each post where the key is “thepostID” and the value is the actual post ID number. And I’d like this to happen automatically for each post.
Why, you ask, would I want to do this when the Post ID is so easy to get in other places? It’s a tale of two plugins.
I’m building a slider with one plugin to show the custom post types generated by a second plugin. The second plugin has a great shortcode for displaying its info that I can actually call in the slider authoring tool. But the shortcode requires a Post ID as one of its parameters.
The slider plugin, bless its feature-rich heart, allows access to all kinds of info about posts, like the_title and the_excerpt and anything in the postmeta table! But not the Post ID.
Plugin #1’s support had the decent kludge idea of storing the Post ID in the postmeta table, which would make it accessible to me.
I know how to add custom fields manually in the admin interface, but I’d love for this to happen automatically behind the scenes. Unfortunately, my coding chops aren’t up to the task.
Help and thanks?
- The topic ‘Auto-add post ID as a value in postmeta table’ is closed to new replies.