The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
0answers
11 views

How to update post meta in schedule event action-function?

I want to execute something like this. What I must to change in following code? wp_schedule_event( time(), 'hourly', $string); add_action($string, 'do_this_hourly'); function do_this_hourly() { ...
-3
votes
0answers
44 views

Post rating without plugins?

Is there any simple post rating snippet which will work when page is cached. There is many functions, for example this: <form method='POST' action=""> <input type=hidden name=rate ...
0
votes
0answers
13 views

Unable to update_post_meta with data from wp_dropdown_pages

The pages are showing in the admin panel but I can't save them. When I select and update, it goes back to the first page in the list. I want to be able to save, so the admin can see the selected page ...
0
votes
4answers
114 views

Remove href tag from wp_postmeta in 34,000 posts?

I'm using Godaddy Hosting, PHP 5, and Wordpress 4.2.1 I have 34,000 + posts that need outdated href tags removed. I am able to remove tags, one post at a time, by using this code in a page template ...
0
votes
0answers
11 views

Include timestamp in a foreach array

Please forgive me for my ignorance and thank you to anyone who helps. I have a follow/unfollow plugin that stores the respective user ids using update_post_meta. I am now doing a foreach loops to ...
1
vote
0answers
66 views

Update post meta using save_post hook in multisite

I am trying to update a post meta field in a custom post type in Multisite. i am using the save_post hook to do so unsuccessfully. I don't know if the reason / cause is the multisite? or wrong use of ...
0
votes
0answers
39 views

WP-API : post_meta not updated… but have another entry

When creating a post, I put some post_meta here is the code for the creation edition and deletion of a post https://gist.github.com/eduplessis/dc530523f0b98ae233dc and here is the result of the ...
1
vote
1answer
48 views

How to get update_post_meta output to include string length

I'm using the plugin WP All Import to import a special post type. The plugin includes an action hook pmxi_gallery_image that runs after the import that saves the attachment images to the post gallery. ...
0
votes
1answer
55 views

Reason action hook won't work with update_post_meta from frontend form? Alternative?

The code below works when I am inserting a post/using add_post_meta when submitting a form. The page refresh is flawless (see How can I fix a slow redirect after form submit from frontend (no ...
0
votes
1answer
51 views

Post meta checkbox becomes unchecked occasionally

I removed the default author meta box on posts and added it back with a checkbox that I use to determine if a post should show the author's byline and author box. It's been working, but for some ...
0
votes
1answer
54 views

update_post_meta not working in function

I am attempting to take some custom field meta data (generated via the ACF plugin) and save it as post meta with a function. This is what I've come up with: function tps_create_slotcode($post_id) { ...
0
votes
0answers
21 views

random select option via code ACF

i have a select field called type created via ACF with choices as red,green,blue,yellow . what i am trying to do is random set one of them as 'type' via functions.php when post is published. but it ...
0
votes
1answer
46 views

Proper Way to Sanitize Meta Input

I have a meta field which gets displaed in the admin panel look like: $field = get_post_meta($postid, 'field_name', true); ?> <input type="text" name="field_name" value="<?php echo ...
0
votes
0answers
30 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
106 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
1answer
91 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
32 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
42 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
82 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
1answer
74 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
234 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
63 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
121 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
83 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
114 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 ...
-1
votes
2answers
50 views

Create custom field on post draft or publish?

How to automatically create custom field on post draft or publish with one of several offered values? For example I wish to create custom field named "random_color" with one of potential values: ...
0
votes
1answer
197 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
76 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
134 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
132 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
56 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
290 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
301 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
441 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
154 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
165 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
532 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
105 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
302 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
58 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
134 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
183 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
265 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
323 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
474 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() { ...
1
vote
1answer
125 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
1answer
96 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
106 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
30 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
272 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']); ...