Questions tagged [wp-update-post]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

Sql query to update urls automatically for future posts?

how can i update one url to another for upcoming post automatically. For ex. if "google.com" appear in any upcoming post update it automatically to "fb.com". Any code or plugin to do that ? btw i ...
0
votes
0answers
13 views

Custom Meta Box (SELECT2) Giving Wrong Taxonomy Tag

I have update this code, Category taxonomy working fine, but tag taxonomy not working. /* * Add a metabox * I hope you're familiar with add_meta_box() function, so, nothing new for you here */ ...
0
votes
2answers
38 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
23 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
28 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
26 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
29 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
0answers
28 views

Changing the “Post Published. View Post” admin notice message after running `wp_insert_post_data` filter

I am running a validation logic for when a user is attempting to publish a post, the validation is made possible using wp_insert_post_data filter. If a user wish to publish a post, the filter will ...
0
votes
0answers
28 views

Pass post ID to wp_update_post

Need your help. I have created a custom post type and have a list table of the latest 10 posts. I need to change the post status of those post which I check a checkbox. However, I can not figure out ...
0
votes
1answer
29 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
31 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
255 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
56 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
36 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
25 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. ...
2
votes
1answer
413 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 = array( 'ID' => 45, 'guid' =&...
0
votes
1answer
652 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
0answers
31 views

2 pages falied to update after installing Gutenberg

I have been updating a ton of client's Wordpress sites to the newest version and all has been going smoothly except for this one. There are 11 pages on this site and all but 2 updated with no issues. ...
0
votes
2answers
50 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
21 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
497 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
924 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
422 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
161 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
98 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
18 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
25 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
742 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
36 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
2k 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
258 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
64 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
134 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
627 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
171 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
469 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', ...
0
votes
0answers
456 views

$wpdb->update query incrementing value on it's own!

I want to get value of column and increment it by 1. After increment, update the value in column.For example: In column post_likes the current value is 4. I am incrementing it by 1(like this $var++). ...
0
votes
1answer
19 views

Front Page post mirroring revisions to other pages, constantly updating itself

The site I'm working on has a very strange problem. When any page is updated, the Front Page is updated with the same content. Changing what page is set to the 'Front Page' seems not to matter. I ...
1
vote
1answer
589 views

How trigger to save post when updating post meta

I have very confused situation. I have added posts and all posts metas from one website db to another one, everything is fine, images, title, description of posts are there. But post metas are not ...
0
votes
1answer
197 views

save_post affect creation and deletion

I wrote a little bit of code to update the post name and slug (of my cpt) when saving. This is working nice when I update a post. I just noticed theses few lines are affecting the creation and ...
0
votes
1answer
461 views

Use /prefix/postname as a slug in post_name?

I have a custom field that I would like to use as the post's slug. I'm able to get the custom field to be used as the slug for the post but I'm having problems attaching a /prefix/ before the postname....
1
vote
2answers
324 views

How to update all posts but the current one (post__not_in not working?)

I'm trying to unpublish (set post_status to draft) all posts when a new one (with specific conditions that don't really matter right now) is published. Here's what I currently have: function ...
1
vote
0answers
203 views

how to transition to custom post status on post save

I'm trying to add a custom post status "Needs Review" for posts/pages that have been updated by an editor, so that admins can easily see what has been updated and review the changes. The planned ...
0
votes
1answer
469 views

wp_update_post meta causing 500 error

I'm troubleshooting a client site on GoDaddy and I have this strange issue that when I try and run update_post_meta the server throws a 500 error accompanied by this error message: Fatal error: Call ...
2
votes
2answers
694 views

Update post date on every new comment?

I would like to update a post on every new comment, so that the Last Modified Date is always up to date on the sitemap. How can i do this? Thanks.
0
votes
1answer
21 views

how to update editor content from metabox

hello am trying to update and add editor content from metabox not using the default editor so i tried to use wp_update_post($array); but doesn't work it cause issue Fatal error: Maximum ...
3
votes
2answers
307 views

Keeping post_date same as the pending post_date on privately publishing the post

I'm saving my CPT in private status. So the transition would be from pending to private. Thing is, when the post was first submitted and is pending there's a date of that submission on the post_date ...
0
votes
3answers
563 views

What does wp_update_post() do that the $wpdb class does not?

I recently had to make direct changes to my wp_posts table from a WordPress plugin. I first tried to do this with wp_update_post(), thinking that would would do it. Apparently, wp_update_post() is ...
1
vote
1answer
166 views

“Internal Server Error” with wp_update_post

I am coding a plugin for one of my sites which will toggle two pages statuses when a button is pressed. So when the ON button is pressed it will turn one page to draft while publishing the other, and ...
4
votes
2answers
1k views

What are the limitations of wp_update_post()?

I have two fields in wp_posts table that wp_update_post() seems to be unable to change. I'm trying to use the following code: $echo $group_access; $echo $tag_list; $my_post = array( 'ID' ...