The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
7 views

Update post_meta field only when present

Present update_post_meta internally calls add_post_meta if the value is not present. What i want is to avoid calling add_meta if the value is not present and the value passed is '' (blank). I do ...
0
votes
0answers
42 views

update_post_meta returning false when called during init

Given a custom URL like: http://clientsite.com/tvt?pmc_task=member_check&post_id=1041&user=3851&status=approved I'm trying to catch the URL and add the user_id to a custom post meta ...
0
votes
0answers
19 views

Advanced Custom Fields “update_field” with value from another? [closed]

I am using Advanced Custom Fields, and I want to update the value of a field, with the value of another one on the same page. (I'm referring to a backend form, not a frontend form). I have a select ...
0
votes
1answer
51 views

Programmatically set thumbnail via URL using DOM and XPATH - Where to add ELSEIF

EDIT3: I have gotten some outside help and have totally changed my code around to now use xpath to select the div instead of using the nth img from the html source. I am happy to say this is working! ...
0
votes
0answers
18 views

Performace on 1 million plus meta fields vs 1 field with 1 million multi array

We are potentially looking into building a counter in a post_type. So a post meta field wil be created with some data like total downloads and downloads left (tied to user ID). We expect up to one ...
0
votes
0answers
22 views

Trying to add $_POST Array to update_post_meta doesn't populate

This is the code that is sending the info: $postdata = array( 'show_id' => '11', 'show_start' => '2015-03-17 11:00am', 'line_items' => array( '1' => array( ...
0
votes
0answers
31 views

Problem with 'save_post' hook not running

I have a custom post type, with a custom meta box which contains a number of input fields. The meta box is displaying fine but when completing all the fields the data is not saving, in fact, the ...
2
votes
0answers
42 views

Efficient way to save a lot of meta data

im currently developing a plugin that will read an external xml, and convert the data to a custom post type. Each post needs around 50-60 meta_fields. Right now im looping through each piece of needed ...
0
votes
1answer
111 views

Making Wordpress author follow button, need missing ingredient

So i'm trying to make a follow button in wordpress where users can press a button that allows them to follow an author they like. (No, i'm not interested in buddypress) What i've done so far is use ...
0
votes
0answers
31 views

Insert post programmatically and decide to tweet or not to tweet

I am inserting a new post using wp_insert_post() and want to be able to decide if this post gets tweeted or not using the WP to Twitter plugin. First, I create the post, like so: $newpost = array( ...
0
votes
3answers
81 views

Meta box data not saving

I have just started working with custom post types and meta fields/data. I'm able to get the custom post and meta field to appear. It just won't save. I've been staring at the code and reading up ...
0
votes
0answers
48 views

How To Get WordPress Categories Last Update Date?

I am trying to make a custom sitemap for my WordPress blogs categories. For that I added the below code in my functions.php file and save it. Now all things is working fine but I want to get the date ...
0
votes
1answer
58 views

Saving custom image meta fields

I have currently added a custom meta field for uploading a media file (image). I can successfully add the upload button to display and work but I'm having problems saving the field when updating the ...
0
votes
1answer
82 views

get_post_meta unserialize issue - retuns boolean(false)

I´m using a simple custom plugin that parses and saves external XML data as a serialized array in a custom field. This works fine, however, when I update the post, instead of the array I only see a ...
0
votes
0answers
51 views

Update the published date of a post to custom field date

I'm not sure if this is possible with WordPress or not. I googled a bit and didn't found any answers. So I need to update the publish date of a custom post type with the custom field date I entered. ...
0
votes
1answer
65 views

How to update the title of audio file through its attachment metadata

I am trying to programmatically update some metadata of audio file attached to a post. I have been able to update the artist and album properties of the audio file but title doesn't stick. I can go ...
1
vote
1answer
90 views

Setting post meta data to random value during post status transition / on publish

Upon publishing an unpublished draft, I'd like the custom meta value "post views count" to be set to a random variable between 829 and 1013. I am using the code below, which doesn't always work. It ...
1
vote
1answer
49 views

Save re-arranged draggable post items to wordpress database

So i've followed the clearly documented pages for the packery and the draggabilly plugins to allow for a customizable grid and looked at how localStorage can be used to remember/store data of the ...
0
votes
0answers
197 views

Automatically add custom fields (post_meta) to all published posts, hourly, via wp_cron?

I'm trying to update the post meta of all published posts hourly (via wp_cron) with the code below: if ( ! wp_next_scheduled( 'postviews_updatedcounts_hourly_event' ) ) { wp_schedule_event( ...
0
votes
2answers
167 views

WP update_post_meta link loop

I've tried to update post meta by link in loop. Here is code function make_sticky($post_id) { // Update, add, or delete field ---------------------------------- if ( get_post_meta($post_id, ...
0
votes
2answers
234 views

Efficient way to update multiple post meta

I have managed to update post meta using update_post_meta(). However, the more posts I have, the more time it takes. I would like to minimize the time it takes to process say about 400 posts (although ...
1
vote
1answer
99 views

WordPress update_post_meta updating with empty meta_value field [closed]

I'm usuing custom fields pluging and my code has to fill them automitcally, everything works fine except 2 strings: The way i'm getting the fields: foreach($postMeta as $key => $dataTmp) ...
2
votes
1answer
89 views

How to use update_{$meta_type}_metadata filter to modify meta value

I'm trying to wrap my head around the update_{$meta_type}_metadata filter, in order to modify both post and user metadata before database insertion. After reading the docs and the core, it seems to ...
0
votes
2answers
270 views

What Is meta_id In wp_postmeta?

I am trying to add some data in WordPress Custom Field and via adding more direct records/data in wp_postmeta table via SQL query. There are four column as mentioned below... 'meta_id' - A unique id ...
0
votes
1answer
72 views

Save values from foreach loop in wp_editor

I have created a custom metabox that contains a wp_editor. The wp_editor shows content of a uploaded .csv file and constructs a table. I want to allow the users to edit the table after uploading the ...
0
votes
2answers
197 views

Allow iframe in custom meta box

I've created a custom meta box called 'Location Map' and want to provide a functionality to the client to simply copy paste the location's google map's iframe embed code so that it directly appears on ...
0
votes
2answers
32 views

Update meta_key value for a page

I have inherited a WP site where some home page slides are pulled using <?php $po = get_posts( array('post_type' => 'page', 'meta_key' => 'Home Slide', 'order' => 'ASC', 'orderby' ...
0
votes
0answers
97 views

Auto adding product meta on publish

I currently have this function: add_action('transition_post_status', 'wpse_110037_new_posts', 10, 3); function wpse_110037_new_posts($new_status, $old_status, $post) { if( $old_status != ...
1
vote
1answer
124 views

update_post_meta and get_post_meta not working

I am trying to get the input from a textbox and display it upon update. I don't know if the update_post_meta or get_post_meta is causing the problem. Code //Metabox Hook ...
1
vote
1answer
145 views

wp_insert_post() getting slower the more posts

I have written a bulk import script where I import posts with the wp_insert_post() function and add 1 meta value and 1 term to the post. I have done 6 times of 7000 posts now, but for some reason the ...
0
votes
1answer
160 views

change attachment custom field onChange event

The form is in post creating window. Ajax is posting values, but the values doenst renews. Where can be problem ? Ajax <script> function dynamic_Select(field, aid, value) { ...
0
votes
0answers
326 views

wp_schedule_event not working

I 'm going to create a sheduled update_post_meta and for some uknown reason the function is never fired. Below is the code: add_action( 'save_post', 'scheduled_upm'); function scheduled_upm() { ...
0
votes
1answer
80 views

wp_update_user isn't instantly?

I'm trying to update a user mail recieved by $_POST and use it instantly. It gets changed, however it outputs the old one. What is the way to do it? global $current_user; get_currentuserinfo(); if ...
0
votes
0answers
39 views

Reset postmeta entries every month

I have this currently running on my site, which counts how many times each 'post' has been viewed, adds one view to the count and then saves it in postmeta: function getPostViews($postID){ $count_key ...
0
votes
1answer
75 views

Update post meta without deleting the old entries

$old = get_post_meta($post_id, 'figure_sugsubject_repeatable_fields', true); $new = array(); $figuresugsubjectpositions = $_POST['figuresugsubjectposition']; $figuresugsubjectworkplaces = ...
0
votes
1answer
73 views

update_post_meta does not work

I have meta box in my custom post type where I receive data from a front end form. The issue is that somewhere in this functions, something goes wrong and the data changed in admin edit panel does not ...
0
votes
0answers
25 views

Run function after post is updated

I would like to run a function after a post is saved. That function takes a .txt file thats uploaded with Advanced Custom Field file field, makes it into an array to then a json data. I want the json ...
0
votes
0answers
217 views

add_post_meta not saved

EDIT I changed it to if(isset($_POST['Make'])) update_post_meta($pid,"Make", $_POST['Make']); if(isset($_POST['Year'])) update_post_meta($pid,"Year", $_POST['Year']); ...
0
votes
1answer
239 views

using update_user_meta to rank users

I'm using a plugin that allows users to vote on posts, I'd like to add each vote that's cast to the authors user_meta so I can rank users the same way I rank posts. There's a couple of different ...
0
votes
0answers
143 views

update_post_meta() not working in bulk option

I am following this https://gist.github.com/michael-cannon/5820098 to update bulk values but its not working. I tried to debug each and every step but can't get the exact error. I have the following ...
0
votes
1answer
154 views

bulk update meta value with ajax

I want to update posts meta value in the wp_query to a different value on click. What I am basically doing is making a notification bubble (like stackoverflow). wp_query with the number of posts ...
1
vote
0answers
223 views

How to save double quotes in post meta, when the post meta data is an array? [closed]

Ok so I've been scratching my head on this one for a while. I'm making a plugin that adds a custom meta box to a custom post type. I'm using the update_post_meta function to save the data from the ...
1
vote
1answer
520 views

Change post thumbnail using front end post edit form

I'm trying to get the post thumbnail to change if a user selects a new file on a front end post edit screen. This is similar to the code I use to upload data and set the post thumbnail on a front end ...
0
votes
1answer
353 views

wp_insert_post bulk import 500 server error

I am working on a Wordpress import tool, where I use a custom city table in my database with longitude, latitude which combine with some other text and then import by wp_insert_post(). This works ...
0
votes
1answer
51 views

Custom Post Type not showing anything added by code anymore?

So I have a piece of code written and it worked before, hasn't been edited hasn't been changed, no updates on the WP DB no updates on any plugin on WP and it's suddenly not working correctly. This ...
0
votes
1answer
597 views

update_post_meta not adding anything.(Nor add_post_meta)

So I have made some kind of importer(From another non WP db to my WP db) which handles everything in a click of a button. Now it does correctly create a post type although one of the custom fields ...
0
votes
1answer
37 views

Declaring a var, placing it in a query and using the output of the query?

So i'm wondering if it's possible to declare a variable that you'd place in a query to then use it in a update_post_meta function? This is how I tried to do it. First off I made a connection to ...
0
votes
1answer
84 views

Stop `update_post_meta` from working each time page refreshes?

So my code I have here including update_post_meta makes it work when clicking a button I have although what I fail to find out is how I can prevent update_post_meta from working on each page ...
0
votes
1answer
1k views

Update value of a associative array with update_post_meta

I am trying to change the value of a specific key of an associative array which was saved in my post meta. This is how my array is saved in a custom field: Array ( [0] => Array ( ...
8
votes
1answer
1k views

Why are simple updates to wp_postmeta's “_edit_lock” so slow?

In our MySQL slow query log, the cumulatively slowest query is a simple update to wp_postmeta. Here's an example: UPDATE `wp_postmeta` SET `meta_value` = '1392835505:386' WHERE `post_id` = 94705 ...