Custom field on Quick Edit using select/dropdown - almost working right but not showing currently selected value

I'm new to WP plugin programming but have been tasked with the following. GOAL: Create a plugin that does all the following: Set up default chat departments for each domain. Create custom field using select dropdown to allow choosing alternate chat department for each page. Create custom column in Quick Edit to show selected chat department. Column must be sortable. Allow selection of alternate chat department on each page via Quick Edit screen (and optionally via regular edit screen which …
Category: Web

Get the selected posts IDs to use in bulk edit AJAX call

The WordPress codex for bulk_edit_custom_box, along with this bulk edit example use the following piece of JavaScript to create an array of selected post IDs to send with the AJAX call that updates the posts. $bulk_row.find( '#bulk-titles' ).children().each( function() { $post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) ); }); The full code surrounding this snippet is below. My list tables have input fields for meta values, and the inline quick edit works successfully, but bulk edit fails. When …
Category: Web

Get mysql data for Quick Edit panel

I am trying to output the entries of a mysql table (my own) into the Quick Edit in the Woocommerce product page. I don't mind either way we could do this, either get the table data in the JS or just get the post_id and pass that to the "add_to_page_fields" function whereby I can use php to get what I need. I have managed to find some code that gets the data from post_meta and changed for my own use, …
Category: Web

Remove quick edit for custom post type

Is it possible to remove the quick edit function for a custom post type? I have 14 custom taxonomy with hundreds of terms in each and it takes too much time and resource to load all of them into the source-code of the page. I tried to find a solution using google but most of them just hides the quick edit button, but the code is loaded in the footer by wordpress, so it doesn't really make any difference.
Category: Web

Add 'Description' to taxonomy 'Quick Edit'

This seems fairly straight forward, but I cannot find a definite guide on how to add the taxonomy description field to the quick edit box. I've followed several tutorials on adding fields to the custom quick edit box, but the core fields (name, description and slug) do not follow the same guidelines as adding custom fields to the taxonomy quick edit box. Is it even possible to do so? If not - I guess the best alternate is to create …
Category: Web

Why does this Quick Edit checkbox save the value only when unchecked?

I'm using the group of functions below to create a checkbox in the Quick Edit area of each post in the post listing at wp-admin/edit.php that saves a value to a custom field called headline_news. The issue is when the checkbox is checked, Quick Edit saves the value, but it won't save again when I uncheck a checked box. Via PHPMyAdmin, the custom field value changes in the database when saving a checked box, but does not change when unchecking …
Category: Web

How to use TinyMCE in the quick edit form?

I'm trying to make the description of a post editable - specifically the description of a WooCommerce product, but the issue should apply to any post type. I managed to implement it with a simple textarea, but it shows the bare HTML code and also I cannot add new lines, the Enter key will trigger a form submit. So I want to use the TinyMCE editor instead, but the content isn't loaded in the editor correctly. Here's what I tried: …
Category: Web

woocommerce_product_quick_edit_save hook not fired

I´m trying to add custom fields in the quick edit of woocommerce product. I managed to show fields and populate with jquery but I don´t manage to save data updated. add_action( 'quick_edit_custom_box', array( $action_class, $quick_edit_method_called ), 99, 3 ); add_action( 'admin_enqueue_scripts', array( $action_class, $quick_edit_script ), 99 ); if( $post_type_slug === 'product' ){ add_action( 'woocommerce_product_quick_edit_save', array( $action_class, $quick_edit_save_post ), 99, 1 ); }else{ add_action( 'save_post', array( $action_class, $quick_edit_save_post ), 99, 2 ); } quick_edit_custom_box and admin_enqueue_scripts work very well but neither …
Category: Web

Custom Column in CPT admin table not updated after Quick Edit save

I have a CPT named company with custom fields url and partner. Custom column is shown properly with correct content in CPT admin table. Quick fields are also shown and properly populated for each row. When the Update button is clicked in Quick Edit the post_meta are properly updated, values saved in database, but column's content is not updated by Ajax. If I refresh the page custom column is displayed correctly but the whole point of this Quick Edit is …
Category: Web

admin quick edit existing column in posts

I've been searching for this and all I found was for new columns to create....so... I have a column named Views which shows the number of views the post has. The column name in admin is tie_post_views and the post meta field is tie_views I would like to edit and save the values in that field from the Quick Edit post option. I appreciate your help. Edit: I found a new code that "works" but this is adding a new …
Category: Web

Undefined variable post_id in custom quick edit coloumn

I am trying to add a custom coloumn to post quick edit and everything is almost working. Custom meta is saved and passed but if I click on quick edit the preview is blank. This is the error it gives me: Notice: Undefined variable: post_id in /home/etimueit/public_html/wp-content/themes/caru/functions.php on line 626 Here is my code. function disponibilitaet_quickedit_custom_posts_columns( $posts_columns ) { $posts_columns['disponibilitaet_edit_time'] = __( 'Modifica Disponibilità', 'disponibilitaet' ); return $posts_columns; } add_filter( 'manage_post_posts_columns', 'disponibilitaet_quickedit_custom_posts_columns' );` function disponibilitaet_quickedit_custom_column_display( $column_name, $post_id ) { if …
Category: Web

Rows with custom columns not well formatted after Quick Edit save

I have a custom post type "promotion" made via code put on theme file functions.php. I also added some columns to custom post type list. They seems work fine, but if I Use the quick edit to update the post, the custom columns disappear on save action. The code used to add the custom columns: // ADD NEW COLUMN function promo_columns_head($defaults) { global $post_type; if ( $post_type === 'promotion' ) { $new = array(); foreach ($defaults as $k => $value){ …
Category: Web

Add "Excerpt" in "Quick edit"

I have many posts in which I want to edit the excerpt. But instead of having to got to the edit page, I would want to do it with the "Quick Edit" feature. How can I add the excerpt in the Quick Edit ? PS: I know a plugin exists for that, but I have a custom plugin for my website, so it would be cool if I can add this in it. EDIT: I don't want to use the …
Category: Web

post_row_actions filter is not working while update post using quick edit

I have created two links using post_row_actions, it was displaying fine when page loads. But the links will get disappear after update post using quick-edit. Is it a bug from WordPress or did I miss something. My code will look like given below. add_filter('post_row_actions', 'add_new_link', 10, 2); public function add_new_link($actions, $page_object) { $actions['new_action'] = '<a href="'.admin_url().'post.php?id='.$page_object->ID.'&action=new-action">New Action</a>'; return $actions; } Thank you
Category: Web

Disable "quick edit" only for non admin in functions.php

I have this in my functions.php function remove_quick_edit( $actions ) { unset($actions['inline hide-if-no-js']); return $actions; } add_filter('post_row_actions','remove_quick_edit',10,1); to remove the quick edit link in the backend when scrolling the list of published posts. It works like a charm but it disable it even for the admin role. Is it possible to keep it showing only for the admin while still diabling for the rest? Thanks! SOLVED thanks to jfacemyer! This is the full code to add in functions.php function remove_quick_edit( …
Category: Web

Action 'save_post' not working for quick edit

I have read other answers to similar questions but none of them solved my problem. This code works great in Editor but on Quick Edit or Bulk Edit it does not appear to fire at all. What am I doing wrong? // link author display name to Broker Name if Author is Broker add_action( 'save_post', 'author_is_broker', 200 ); function author_is_broker($post_id) { // page/post options global $lwp_options, $Listing; $post_types = get_post_types(); unset($post_types['listings']); $post_type = get_post_type(); //Only for listings if(isset($post_type) && $post_type …
Category: Web

How to make all the posts commentable by default? Imputs in Settings/Discussions are not saved

I've modified my website quite a bit and now looks almost as I desire. I've set all the posts to be commentable in Settings/Discussions but it seems that this imput is not saved and new posts by authors are not commentable. Everytime, I need to "quick edit" the new post and mark the |_|Allow Comments field as selected |x|. This takes me a lot of time and I wonder if there's a way to have a function to make all …
Category: Web

How to get and edit custom fields if in Quick Edit

I've got some custom fields that I would like a user to be able to edit in Quick Edit, I can manage the columns but I'm unable to edit them if Quick Edit is clicked current code with custom fields I'd like to be able to edit: /* custom columns */ add_filter("manage_edit-programmes_columns", "edit_columns" ); add_action("manage_posts_custom_column", "custom_columns"); function edit_columns($columns) { $columns = array( "cb" => "<input type ='checkbox' />", "title" => "Schedule id", "programme" => "Programme", "channel" => "Channel", "onair" => …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.