The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
23 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
19 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
17 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
54 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
26 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
61 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
49 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
56 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
34 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
42 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
89 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
43 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
100 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
23 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
60 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
79 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
67 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
75 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
177 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
45 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
28 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
63 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
44 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
20 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
162 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
198 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
91 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
118 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
171 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
389 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
293 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
44 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
386 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
34 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
74 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
821 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 ...
0
votes
1answer
62 views

Meta box with front-end styling

I have a specific Gallery post of products that I release at the start of every Monday on my website, which differs from my other Gallery posts. These types of Gallery post don't require the Authors ...
0
votes
0answers
83 views

update_post_meta frontend

Ok I have searched and searched the internet to find an answer to no avail. Here is my issue. I have a form that is pre-populated with metadata fields. I want to have two submit buttons one will ...
0
votes
1answer
239 views

Difficultly changing date format in post meta value

I have a custom post type with a custom field that takes a date. The posts are later ordered by the date in that custom field. Unfortuately I formatted the date incorrectly and there are already a ...
0
votes
1answer
453 views

WooCommerce wp_insert_post action firing on every save

function initial_product_data ( $post_id ) { // lets get out of here if this is not a new product if ( 'product' != $_POST['post_type'] ) return; // make sure the post isn't automagically ...
0
votes
1answer
73 views

How do I delete element from a serialized array upon deletion of a post?

I want to delete an element (post id) from a serialized array associated with a specific meta_key. The following screenshot tells the whole story. What you're seeing are, post ids saved in a ...
0
votes
1answer
64 views

Rich Custom Field for Custom Post type not saving

I am new to creating meta boxes and I am trying to create a custom field meta box that is connected to a custom post type which is created by WooTheme Sensei (Post type = lesson). I am trying to use ...
1
vote
1answer
1k views

update_post_meta() whenever custom post type is updated

I need the following functionality. Whenever my custom post type is updated or saved I need to overwrite certain custom post metas. I need to make sure this only affects posts of the post type ...
0
votes
1answer
422 views

update_post_meta not working in action hook

I'm having a real problem updating custom fields (within a custom post type) with data from the database. I have a table in the database called wp_company_profiles with address fields (i.e. ...
1
vote
0answers
283 views

Bulk update all posts from plugin settings screen

I'm writing a plugin right now that will populate custom metadata for all posts on the site based on a certain rule. I've already created a Plugin's settings page and a logic that should be triggered ...
0
votes
1answer
415 views

wordpress update multiple posts post meta

I am trying to update multiple posts post meta at the same time. I have the following query: <form action="" method="post"> <?php $variations = new WP_Query(); ...
0
votes
1answer
98 views

Use an id on a button to update_post_meta in post

I hope that someone can answer this conundrum for me.. As its doing my head in a bit LOL. I have a button with the code as follows: <button class="contact-owner-send" ...
0
votes
1answer
1k views

update_post_meta and update_field ony working when saving the post

I use Advanced Custom Fields (ACF) to store data in a custom field. I had latitude and longitude information stored separately, but I they need to be in one custom field so I made the function below. ...
-2
votes
2answers
72 views

Update an existing post in a custom post type

Lets say we have a connected user that access one of his post to replace some existing information in X fields that already exist with some new ones. How could I manage to update the old ones with ...