Linked Questions

5 votes
1 answer

Can't get post ID in functions.php?

I need the current post id in a function , which I have written in functions.php. But I can't get the id. I have tried several method. Like get_the_ID(); //returns false global $post; $id = $...
shuvroMithun's user avatar
8 votes
3 answers

New image size version only for the Featured Image file

I'm worried about too many files created when adding a new image size. All uploaded files will generate the new size, I need a specific image size only for the file set as Fetured image, is there ...
Diana's user avatar
  • 1,238
3 votes
2 answers

Is there a hook / action that is triggered when adding or removing a post thumbnail?

I'm trying to update a custom field after a post thumbnail (Featured Image) is either added or removed from a post. The aim of this is to keep track of whether a featured image has been added or ...
Rick Curran's user avatar
  • 1,076
0 votes
1 answer

is there an update_post_meta action

Are there any actions I can hook into for update_post_meta()? I don't see anything obvious in the source. Woocommerce lets you change the featured status of items via ajax from the edit screen. I ...
helgatheviking's user avatar
1 vote
2 answers

Filter For Featured Image

Is there a filter for when a Featured Image is set/unset or changed. I need to delete transient data when the above occurs.
Colin Murphy's user avatar
1 vote
2 answers

Determine when a custom field was last updated?

Would anyone know of a way to determine when a custom field for a post was last updated? I'm trying to write something that says "If CUSTOMFIELD was updated in the last 24 hours don't do anything, ...
Nathan's user avatar
  • 431
-1 votes
2 answers

How can I add a custom meta value on file upload?

I am looking for an option where a custom meta value will be saved when user uploads an attachment. Lets say I need a meta key _example_meta_key and want to save meta value of this as ex087659bh (It ...
Bhupathi Reddy NeverLie's user avatar
1 vote
0 answers

Compare meta_query with a Regular Expression and do a less-than operation on it

I have the problem that my client is using a theme which stores options of items in a serialized way in the post_meta table. I already found out that this is not the best way to save values ...
helle's user avatar
  • 318
2 votes
1 answer

Automatically Add Specified Value to Attachment Metadata upon Upload

I am trying to create a function that automatically adds a value to the attachment metadata (if it matters, on Audio uploads). For example, I want to add a value of 'artist' and output it as my own ...
bbruman's user avatar
  • 464
0 votes
1 answer

A faster way to query custom post types with multiple conditions?

I am using a lot of custom post types (CPTs) with custom meta and so far I have been using queries like the below, to get for example all events in CountryX that happened in 2014: <?php global $...
andreas's user avatar
  • 11
0 votes
1 answer

Can I use pre_get_posts to add up values from two different meta_keys?

I'm storing post meta values _likes and _dislikes in postmeta. In some cases, I want to be able to query for posts by their netto score (likes minus dislikes) and order them by it. I'm familiar with ...
Marc Dingena's user avatar
  • 1,112
0 votes
0 answers

How to track product price changes?

I am writing an API plugin. Every time a product or quantity changes in woocommerce, I need to export a new price to the server. Also in the IPA there is import, which I will conduct through cron. ...
Виктор Юстус's user avatar