Hot answers tagged

2

You're adding the action on comment_form_before_fields in comment_form_logged_in_after. The latter is called only when the user is logged in, and the former is only called when the user is not logged in. You can add WordPress actions and filters at any time after WordPress is initialized. If you're adding the action in a plugin, add it on init or even when ...


2

The add_attachment action is fired when the wp_insert_attachment() function is called to add an item to the media library. Images are added to posts after going into the media library first. Even when adding via the post editor, items are added to the library with wp_insert_attachment() then to the post. add_action( 'add_attachment', xyz_my_function() { ...


1

The delete_attachment action is fired when wp_delete_attachment() function is called to delete an item in the media library.


1

while googling about the same issue I came upon your question and a similar question from the Wordpress forums. You can control the output of the generated code via the image_send_to_editor filter like this: function filter_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt) { $html = sprintf('<a href="#" ...


1

I see two things. You're missing an action call - you need add_action( 'wp_ajax_render_admin_charts_page', 'render_admin_charts_page' ); add_action('wp_ajax_nopriv_render_admin_charts_page', 'render_admin_charts_page'); Plus, from looking at your render_admin_charts_page() you need to change your json dataType to html. Your charts function is outputting ...


1

@AlexanderFarber, there are many way to attach attribute class under wp_nav_menu link. I agree with @Sumit, adding page links in Appearance > Menu WordPress take care of current-menu-item class or current_page_item class. Also, this way is best practice to handle your nav menu in the future. Create dynamic link in wp_nav_menu Since your question related ...


1

Plugins are loaded in the order of their file names. e.g. plugin with name abc.php loaded first then xyz.php so if you are trying to remove an action from plugin abc.php and that was added in plugin xyz.php then it is not possible without any tweak. Because action was never added at time you are trying to remove it. You can simply place a die(__FILE__); in ...


1

What your function says: On FRONT END do this before template display:      if user is logged in:           check if you are NOT on admin page (back end), if you are not on admin page:               , ...


1

The use of header() function produce output in the middle of the request and crash it. To modify uploaded image you should use wp_handle_upload filter instead of save_post action. Also, ideally, you should use WP_Image_Editor class, which will use the best image manipulation library available in the server (GD, Imagemagick) and triggers several filters and ...


1

The comments_array filter as part of the comments_template() function, the purpose of which is to load a comment template. It filters comments being prepared to be rendered in the comment section of singular type pages. The preprocess_comment and comment_post actions (in that order) both fire as part of the wp_new_comment() function, the purpose of which is ...



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