Custom Fields on Page/Post Editor interface
-
The short version:
I need the ability to add a custom field to the Post/Paged Editor interface, beyond what the postmeta/custom field tags can do.The Long Version:
There are a dozen or so applications I can think of where this would be beneficial to me but I’ll cover a specific one for example.I’ve got a site (https://collectorsedition.org) where I’ve got an extensive database external to WP. I have custom templates setup to display the database info on WP pages that use that template. In the custom database I have a table that correlates the database record ID to the WP Page ID.
Because of this when I create a new page in WP I need to specify which DB record ID to use… I could add a custom field where I enter the ID but there are a number of problems wit this:
1. there is no data fidelity, in that WP stores the custom field info as a varchar as opposed to an int and this could currupt the data, not to mention it could store duplicates where this needs to be a 1 to 1 relationship.
and
2. I don’t know the record ID off the top of my head so I’d rather specify the long display name of the record from a drop down list as opposed diving into the db every time I create a new WP page.—————
Where I am so far:
so far I’ve found that I can append things to the post/page editor through the “the_editor” filter hook. I’ve been able to add a drop down list below the editor window with a database driven list of games with ids correlating to their db record id.Now my problem is that I still have no way to utilize that data. It would seem that even if it does get sent with all the other $_POST data upon saving/publishing it’s already been erased by the time I can do anything with it.
I’m thinking I might be able to grab it using the admin_head action filter or some flavor of admin_head-(post_hook) but I have no idea how to use that filter since it’s completely devoid of useful documentation.
If anyone has any insight to lend, or could even just point me towards some other plugin that successfully adds custom inputs to the page/post editor I would be very appreciative.
- The topic ‘Custom Fields on Page/Post Editor interface’ is closed to new replies.