Questions tagged [wp-update-post]
The wp-update-post tag has no usage guidance.
169
questions
1
vote
0answers
8 views
Allow Post Author to be 0 on Update
I have a custom post type that allows registered users to submit videos to my site. I have modified the script so that non-logged in (guest) users can also submit videos. I've added first-name, last-...
0
votes
0answers
22 views
Run a function when a custom post is update?
There is a custom post type. Each post has a repeater field. When a post is updated, I need to get a value from the repeater field and insert it into a custom table in the WordPress database. To do ...
0
votes
0answers
22 views
Update a post every 60 seconds [closed]
I would like to update a given post or page every 60 seconds, but I have no idea how to do.
How can i do this?
Thanks
0
votes
0answers
18 views
I change post date, but it updates only after refreshing the page
Here's my snippet:
function prideti_mygtuka($post){
echo'<div class="igno-button">';
echo '<form method="GET">';
echo '<input type="hidden" ...
0
votes
0answers
15 views
wp_set_object_terms Not Updating unless I click update twice
I am using code from this answer to create a new child taxonomy term, however for some reason the change only takes effect if I click update post twice. Clicking Update Post once doesn't save the ...
0
votes
0answers
14 views
Cannot update newly added User field using wp_update_user
I want to add a new attribute to the wp_user table, "twitter_id" for example.
I added the new column to the wp_user table, and it is added correctly. I get the current user (as I want to ...
0
votes
1answer
24 views
Update post if exist from PHP
I want to publish post from php for automation reasons with dynamic data and cronjob.
I have almost succeeded, you could say that it works, but in an incorrect way.
If the title doesn't exist, create ...
0
votes
0answers
16 views
wp_update_post() doesn't update post_status
First of all, I've already checked the solution for this question:
Why doesn't wp_update_post() update the post_status field?
I am having trouble with updating post_status of products and ...
0
votes
0answers
20 views
Update post when countdown reaches 0
I have a countdown linked to an ACF Field that displays the number of days before an article expires.
I want the post to automatically update when the countdown reaches 0 (because when the post ...
0
votes
0answers
17 views
Update post “A” on comment submition on post “B”
Hello and thanks in advance for any help. Im trying to update the post status from a post when submiting a comment on other post, I have a variable in the url pointing to the ID of the post I want to ...
0
votes
0answers
28 views
Sort by date Function ? post date randomizer wordpress
function pdr_randomize() {
$randomize = isset( $_REQUEST['randomize'] ) ? $_REQUEST['randomize'] : '';
if ( isset( $_GET['pdr_rd_nonce'] ) && wp_verify_nonce( $_GET['pdr_rd_nonce'], '...
0
votes
0answers
66 views
wp_update_post gives 500 internal error
i'm editing a wordpress plugin and im trying to call a function within the thank you page, and in that function it has wp_update_post function to change the status in the database, the function works ...
0
votes
0answers
11 views
Keep showing Error everytime i updating a page main site[Multisite]
I'm having a multisite, I recently noticed that there will have errors when I updating the page. But, nothing goes wrong with the sub-sites. Only main site.
This the message I got when I deleting the ...
0
votes
0answers
24 views
Updating Post Hang/503 error
I am trying to copy the WooCommerce Description (post content) to the Short Description (excerpt) on post save.
My current solution is:
/* Do something with the data entered */
add_action( '...
1
vote
0answers
24 views
How to bulk edit image url in featured image and product description?
I have tried a few plugins (free) but none update the url in featured product image and product descriptions.
How can I update in bulk instead of doing one by one? If there any any plugin (...
0
votes
1answer
357 views
update_post_meta not working with transition_comment_status
I'm trying to save an average of comments as a post meta that needs to be updated every time according to comment status.
/**
* Gets comment average data.
*/
function sw_get_averagerev( $post_id ) ...
0
votes
0answers
9 views
SQL: trying to update posts that have certain custom meta
struggling with an SQL command..
I want to change a post type from 'post' to '2month' that have custom meta (low_jobs = 'under 100') and do not have certain categories
UPDATE wp_posts.ID
SET ...
0
votes
0answers
21 views
Change Human Time Difference Number Language
I have added function
/* Function which displays your post date in time ago format */
function human_time_diff_nepali( $from, $to = '' ) {
if ( empty( $to ) ) {
$to = time();
}
$diff = (...
0
votes
0answers
305 views
Log validation information
When updating a post I get the following error message.
Validation failed. 1 field requires attention
I cannot deduce from the user interface which field requires attention. The field may not be ...
0
votes
2answers
212 views
Custom Meta Box (SELECT2) Not Saving Taxonomy Terms
I have the code,
/*
* Add a metabox
* I hope you're familiar with add_meta_box() function, so, nothing new for you here
*/
add_action( 'admin_menu', 'rudr_metabox_for_select2_cat' );
function ...
1
vote
1answer
185 views
How to get the Tags on Publish post hook?
Requirement: On the each publish/update post, we need all tags from
the post and do some functionality on that.
Case 1:
Create post, add tags and Publish immediately
=== WORKS PERFECT ===
Case 2:
...
0
votes
0answers
49 views
update_post_meta not working in template_redirect action
I have a problem
I'm trying to listen to a webhook, and I can do it, I check with the help wp_mail function and I get all the data
But I want to make a add data in the database, and for some reason ...
0
votes
1answer
149 views
wp_trash_post() duplicates post to trash
I'd like to move a post to the trash in the loop. Here's my code;
function run_every_five_minutes() {
global $post;
$wp_query = new WP_Query(array('cat' => array(1), 'posts_per_page' => ...
0
votes
1answer
259 views
wp_insert_post($post), add an array of values with update_post_meta
i try to store an array in multiple custom fields via post creation (wp_insert_post).
The array is $event_test and the key is event_test on the meta_input.
On form submit, the custom field is shown, ...
0
votes
1answer
78 views
Change the term based on the value of a $variable using wp_update_post in submitting a form
Background
I am using a fronted form to submit data to a meta box by use the
wp_update_post to a custom post type (call) with a custom taxonomy (call-type).
It then also updated the terms and ...
0
votes
1answer
119 views
Update post (published) date when changing category
Is there a way to update a post (published) date when you change the category/taxonomy to a specific one?
Example:
- Post type "Projects"
- 2 categories: Progress/ Done
When you change the category ...
0
votes
1answer
656 views
How can I trigger a javascript function after a post update on edit post screen in wordpress admin panel?
I use Wordpress 5.2.2 and I develop a custom theme.
EDIT : On my theme I added a metabox who show an input type="text".
Code in functions.php of my theme
if ( ! function_exists( 'vn_add_metabox' ) )...
0
votes
1answer
346 views
Set a post expiration and delete a post when expirate
I'm trying to create a function that allows me to delete an article when the date of the day is equal or superior than a date filled in a custom ACF field.
I wrote the function below that I placed in ...
0
votes
1answer
58 views
Update all WordPress posts's title and content then display them in a table
I am trying to update all the WP post title and content then show the just updated post to a table. I am using the following code but it does not work:
$args = array(
'post_type' => 'post',
'...
0
votes
1answer
33 views
Update around 200,000 posts
So I have recently migrated from a regular site to a wordpress CMS all via MySQL. I successfully was able to adapt the old database with that of WordPress.
Now, the site has content in 3 languages. ...
4
votes
1answer
1k views
Why wp_update_post() does not update GUID?
I'm trying to update GUID on a attachment. But somehow it's not working neither it's throwing any error.
Example Code:
$my_post = [
'ID' => 45,
'guid' => 'https://example.com/foo.png'...
0
votes
1answer
1k views
Update status, meta while inside a post using AJAX button
So I am trying to click a custom button I made in a meta box the fire off AJAX. All works except getting the ID of the post and the refreshing of the page. I have tried using global $post; $post_id = $...
0
votes
2answers
85 views
How to automatic update date and time when save custom post type
I need to update date and time when I save posts.
I see the code on the following thread, but I need to have this trick only for posts contained in my custom post 'new_cpt'
Is it possible?
ref: ...
0
votes
1answer
32 views
How to update the children of a post?
i found nothing about it in the WP reference and Google, so i ask you: I want to update a post by a form - and with it its children.
$post = array(
'ID' => $mainid, ...
0
votes
1answer
1k views
Post meta data not showing in frontend, until hitting 'update' button
I try to insert around 2000 video-posts into WP. There is a custom field in the theme for the video-url, so I add the video-url to the post meta data with the corresponding field name. ACF seems not ...
0
votes
1answer
2k views
Inline style HTML attribute is being stripped from all elements of a post
I am attempting to publish HTML generated from an external party within Wordpress, but I am getting very inconsistent results with style attribute on all HTML elements, in that if I programmatically ...
1
vote
1answer
859 views
What's the proper way to use a custom table? [closed]
I manually added a table to my wordpress database using sql using CREATE TABLE. I want to add functions for adding, modifying, and removing the data from this table just like with wp_update_user().
...
2
votes
1answer
341 views
Can I edit the wp_post > post_content right before its inserted/updated?
I would need to apply some sort of encryption on whatever gets inserted in the wp_post > post_content, so I was wondering if there is a way, either modifying the core (rather not), or using some ...
0
votes
1answer
176 views
Frontend form with multiple posts
I've been researching frontend post-editing/creating forms, but I can't seem to find anything about having multiple forms on the same page. Please excuse my shaky understanding of POST methods.
Here ...
0
votes
0answers
21 views
recursively update content
the problem
I'm trying to translate a wordpress 4.7. But the site was consived in spanish and just now I installed the WPML plugin, now after 5000 post uploaded.
I am using the visual composer and ...
0
votes
1answer
28 views
Updating my Post when expiry date is past
I have done some more reseach and come accross the following article which does exactly what I want it to do. According to the writer, the code works but when I try and adapt it to my circumstance it ...
1
vote
3answers
2k views
Clear cache on post of one type when something happens to post of other type
EDIT: Based on @TimHallman's answer I have a follow-up question, please see the bottom of this post.
I am trying to do something that is way over my head and the more I think of it, the more ...
1
vote
0answers
45 views
When User Meta amended update Title and Slug of Post programatically
I have this code below which works perfectly, i.e. when adding a new User a post is programatically created in my CPT.
add_action( 'user_register', 'add_member_employees' );
function ...
0
votes
1answer
4k views
How to change post status from “draft” to “publish”?
My script uses code to set post content.
I am also running the WP To Twitter plugin, to auto-tweet those posts.
The problem is, whilst the plugin is correctly formulating its tweets using the default ...
0
votes
0answers
374 views
Bulk Post update_post_meta
how can use this code for update just post_meta ?
here my code :
function update_all_posts(){
$args = array('post_type'=> 'post',
'post_status' => 'publish',
'...
0
votes
1answer
91 views
Cannot update page - with too many characters?
I have problem with page update. I am tring to save more than 14230 characters. After "update" worpress is moving me to "Posts" page. I show this issue on this video: https://youtu.be/3Y8qgFEizBU
...
0
votes
1answer
157 views
wp_update_post ignores if/else
I have a function that publishes a post if it exists as a draft. But the wp_update_post function seems to ignore the if/else and runs before anything else.
$post = get_posts(array(
...
0
votes
2answers
966 views
update flamingo_inbound post type after insert
I'm having a difficult time trying to update the flamingo_inbound post author after insert.
Basically, I have a hidden field in CTF7 for the company name that is being sent over and correctly stored ...
0
votes
1answer
264 views
Mass Update lines of code for all posts
Bit of a conundrum today. I implemented some query string into my website so I'd like to retroactively update all my previous (600+) posts to update specific hyperlinks to include this query string.
...
0
votes
1answer
802 views
wp_update_post to set post IDs to drafts not working
Specifically WooCommerce Product Pages.
I'm using WP_Query to generate the array.
$params = array(
'posts_per_page' => -1,
'post_type' => 'product',
'orderby' => 'menu-order',
...