Publish/Update post is changing image links from file url to post url
The problem was down to my use of rel=”attachment” in the anchor, with this removed the editor allows the link to remain pointing to the file url and not the attachment.
The problem was down to my use of rel=”attachment” in the anchor, with this removed the editor allows the link to remain pointing to the file url and not the attachment.
The admin_notices hook fires only once per page load, and isn’t fired when a post is quick-edited. You would have to do it browser-side with javascript – that is, listen for when someone edits and saves a post (which is done via AJAX) and use javascript to display a message. A quick glance at the … Read more
Think about what you’re doing here. You’re hooking into the time which WordPress is saving a post. You need to use get_post_meta() to check if the saving post has that required meta key. If you get nothing back, or get_post_meta() returns false, then you need to add your post meta for this saving post using … Read more
I think you want to change default video width. You can change default embed video width and height by embed_defaults filter. add_filter(’embed_defaults’, ‘ravs_embed_defaults’); function ravs_embed_defaults($embed_size) { if (is_single()) { // Conditionally set max height and width $embed_size[‘width’] = 640; $embed_size[‘height’] = 600; } else { // Default values $embed_size[‘width’] = 460; $embed_size[‘height’] = 600; } … Read more
You’re running the query twice and passing the result of the first query to the second query. Give this a try. You might also consider using the update function from wpdb instead of running an arbitrary query because it doesn’t look like you’re doing any data sanitization or nonce checks. If you do want to … Read more
If your problem is: I want to send email if a postmeta of a post is changed to the expected value Why do yous ask for: How can i get the List of post id on bulk edit? This is a typical x/y problem: when you have a problem, ask how to solve that problem, … Read more
You hook the tr_change_show_title to a filter inside the function itself, that can make a infinite loop. All the stuff removing/adding actions and filters inside the functions should be deleted; instead check if the post data should be updated or not. In your case you should check if the title has the value you desire … Read more
I’m going to post this as an answer, because it worked for me: function my_awesome_func ($post_id, $post, $update) { //update the value we need early update_post_meta($post_id, ‘my_meta_key’, $_REQUEST[‘my_meta_key’]); $newValue = get_post_meta($post_id, ‘my_meta_key’); } add_action( ‘save_post_my-custom-post-type’, ‘my_awesome_func’, 10, 3 ); You could also simply use the value of $_REQUEST[‘my_meta_key’] directly if that works, but for my … Read more
You can hack this plugin code by changing ‘create_draft‘ option ‘no’ to ‘yes’ into plugin.php ‘get_default_import_options‘ method(Approx line no. 1013). I’m not tested this hack, try it your own risk.
It all depends on how your “custom fields” are saved. If you store the values as post meta then you would have to call the update_post_meta function to update them on wp_insert_post_data. In the example below Im setting the post meta “my_meta_key” with the string value “my_meta_value”. function save_my_post( $content ) { global $post; if( … Read more