0

I have an already up and running WP web site. Its fully configured - some years ago :-/ Now there is the request to change the image. Somehow I don't know any longer how to do it. I managed nevertheless to find the cirtical code:

 <?php if (get_post_meta($curentPostID, "page_top_img", true) != ''): ?>

To my understanding the code would mean: For each post there is a "meta" tag with name page_top_img configured. I have access to the database. Therefore the question arises where to find the configured data?

i.e. Which table and which column contains the above information?

Since I know the content (=result) from the web page I could do some kind of reverse engineering. Help would be highly appreciated.

1 Answer 1

1

Post meta data is stored in the wp_postmeta table, the prefix wp_ may also be something else depending on your setup, in the meta_value column.


If there isn't a metabox in the post edit screen for updating the value, then instead of modifying the database directly you could temporarily add update_post_meta() call to your functions.php file (hooked to some action for example) to change the value - removing the function afterwards.

Or if WP CLI is available, use wp post meta update command.

3
  • If I add it to the function.php than the box should appear? Or you mean to add the ID of the post into the function?
    – LeO
    Jul 2 at 20:42
  • @LeO Sorry for the bad wording. I meant the latter. If you know which post you want to edit and know the new value, then use update function with the post ID, the meta key and the value to change the post meta. Hacky, yes, but gets the job done, if this is a one time update. If there's a need for more updates and there isn't an existing metabox to change the value, then you'll want to either register a custom metabox (classic editor) or a sidebar panel or a block (block editor) for handling the meta updates. Jul 2 at 21:28
  • Thx - I'll try it out the next days. I am somehow confused of the missing metabox. But I found some kind of directions.
    – LeO
    Jul 3 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.