Tag Info

Hot answers tagged

8

Normally to add fields to quick edit field, we should use 'quick_edit_custom_box' action hook that is triggered only for custom colums, because core colums are explicitly exluded (see code). If we add a custom column, then it will be shown in the list table, but it doesn't make sense, because the column description is already present. However we have the ...


6

I use this to add form fields to the quick edit. It's not entirely easy to do this in WP (yet) and it can be very difficult to find info on how to do it. You have to really dig through the source to find it too. Add Form fields to Quick Edit <?php add_action('quick_edit_custom_box', 'quickedit_posts_custom_box', 10, 2); add_action('admin_head-edit.php', ...


4

It's inlineeditnonce. Check line 1185 of admin-ajax.php for details.


4

There's no hooks to modify the Quick Edit, it has to be done with CSS and/or jQuery. The plugin Adminimize is very good to hide administrative elements, CPTs included. But in the Quick Edit box, for lack of CSS classes or ID's to target, it is not possible to hide the slug field, and only possible to partially hide the date adding a custom option as in ...


3

Both, quick edit and the regular post edit screen, offer an author field. Just take care to set the correct author when you edit something. To see this field you have to enable it in the screen option in the upper right corner:


3

Without doing Ajax (like in Quick Edit), the admin_url should be the very edit.php page. Note that: the filter post_row_actions takes two arguments, the second one being $post, so the global is not necessary. instead of using id as query argument, it's best practice to use custom names, in this case update_id. I didn't know the function get_admin_url ...


3

Use current_user_can to wrap the add_filter call: if ( current_user_can('manage_options') ) { } else { add_filter('post_row_actions','remove_quick_edit',10,1); } manage_options is an Admin capability. If the current user can do it, he's an admin (on a vanilla WP installation). See: http://codex.wordpress.org/Roles_and_Capabilities and ...


3

You can add the following code in function.php $subscriber= get_role('subscriber'); $subscriber->add_cap('edit_comment'); Meanwhile edit_comment is only supported in version 3.1 or newer Or you can use this plugin link


2

You can get the ID per JavaScript from the quick edit screen’s parent tr: that has an attribute id="edit-418", where 418 is the post ID. So extract this number, get the post data per AJAX, and insert the values you need. Not elegant. Read wp-admin/js/inline-edit-post.js to see how the core does it.


2

It comes from wp_insert_post(), where do_action() is called with two additional parameters: do_action('save_post', $post_ID, $post); So it is not you who adds the parameters, it is WordPress. If you register your callback with the fourth parameter set to 2 … add_action( 'save_post', 'mytestfunc', 10, 2 ); … you will even get the complete $post object: ...


2

A small example from my last project. The important part is the hook quick_edit_custom_box. On this hook can you add your form elements. The second important part is to add your script that update the data via javascript. The script in this example was add to the head in edit.php; it is better on footer and you must check the right page. The example source ...


2

You could use the auto generated Gravatar options in the back end which will randomly assign an "avatar" to those who do not have one. You will find this when you go to your WordPress back-end Settings > Discussion and scroll down to the bottom. Or you can have a custom avatar replacement for those who do not have one however this will not be random but ...


2

Check out the builk actions page in the codex. I believe the proper action to unset is inline. This will remove the "Edit" bulk action, which is actually quick edit. <?php function remove_bulk_actions( $actions ){ unset( $actions['inline'] ); return $actions; } ...


1

We have to intercept the Ajax end point of that action. The file wp-admin/admin-ajax.php has all the possible hooks in the $core_actions_post array. The function wpse_65157_ajax_inline_save() is a copy of the Core's, with a "force reload" script printed at the end. It has to be with Javascript, as wp_redirect() doesn't work. add_action( ...


1

Answer remade. The original was a wild idea... The solution is the same as the one posted by Rarst in the question linked How to *remove* a parent theme page template from a child theme? Difference being the admin_head hook. And a check for only running in edit-page and not in edit-post or edit-custom_post_type, as all these cases are fired by ...


1

Based on this answer, yours was easy: add_filter('post_row_actions', 'wpse_49800_qe_download_link', 10, 2); add_filter('page_row_actions', 'wpse_49800_qe_download_link', 10, 2); // for Custom Post Types // add_filter('cpt_name_row_actions', 'wpse_49800_qe_download_link', 10, 2); function wpse_49800_qe_download_link($actions, $post) { ...


1

WordPress does not send the content of custom fields during autosave (just title, slug and content). That’s why the custom field content will be deleted if you try to save the data: You cannot see the difference between deleted and missing content. I would create a separate autosave function for that, because the way WordPress handles it can change any ...


1

A common method to keep all the posts open for comments, is to add this line into the file functions.php in the current theme directory : add_filter('comments_open', '__return_true'); where __return_true is just a core function that always returns true. ps: since this seems to be helpful, regarding to the problem described by @user27309, it's better to ...


1

This is done filtering the *_row_actions. For the Comments screen (/wp-admin/edit-comments.php) this is the hook: add_filter( 'comment_row_actions', 'comments_row_wpse_92313', 15, 2 ); function comments_row_wpse_92313( $actions, $comment ) { if( !current_user_can( 'delete_plugins' ) ) unset( $actions['quickedit'], $actions['edit'], ...


1

Ok, I got it, here's the code: function ilc_quickedit_save($post_id, $post) { if( $post->post_type != 'evento' ) return; if (isset($_POST['is_quickedit'])) update_post_meta($post_id, 'eventdate', $_POST['eventdate']); } function ilc_quickedit_get() { $html = '<script type="text/javascript">'; $html .= ...


1

A couple things, Make sure in your save_post hook you're checking for DOING_AJAX which is used for saving in quick-edit. Check out my other question: Quick edit screen customization. The answer I received worked, but I haven't actually implemented it into my plugin quite yet as it's not a priority of mine yet. Hope that helps you out. ;)


1

Make sure that show_ui and show_in_menu are set to true when the post type is enabled. then all the usual post/pages features will be available. See http://codex.wordpress.org/Function_Reference/register_post_type Also make sure that those features are explicitly declared as by the CPT as supported.


1

Unfortunately it is impossible to extend... Why? Because quick editing stuff (for certain post) is "hardcoded" and couldn't be extended by plugins... To prove it lets investigate the code: When you click on Quick Edit link, inlineEditPost class (in inline-edit-post.js file) handles it and calls edit method. Take a look at 136 line, here it takes post ...


1

Why not just hide the column from view using CSS ? .column-yourcolumnname { display: none; }


1

There are two flaws in the code that I can see. The first one is a bug in this code if($post->post_type != 'product') If no post exists, you get the following error Notice: Trying to get property of non-object... This can be fixed by first checking if a post isset if(isset($post) && $post->post_type != 'product') Secondly, ...



Only top voted, non community-wiki answers of a minimum length are eligible