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

You can add a filter to page_link to modify link output: function wpd_add_fragment_to_pages( $url ) { return $url . '#navbar'; } add_filter( 'page_link', 'wpd_add_fragment_to_pages' );


2

Why not get all post_types and loop through them with the filter. This should work if the callback for all post types is the same (managesortablecolumns). The code will look something like this: function init_managesortablecolumns (){ $post_types = get_post_types(); foreach( $post_types as $post_type ){ add_filter( 'manage_edit-' . ...


2

Make use of custom parameter, lets call it wpse__current_year, which will accept two values, true (includes current year) and false (excludes current year). Lets incorporate that function show_monthly_archive( $post_type ) { $current_year_args = array( 'type' => 'monthly', 'limit' => '12', ...


2

What you found is actually perfectly accurate. With WP's commitment to backwards compatibility it's not that common for thing to stop working. This filter is used in wp_set_auth_cookie() to calculate the duration. Resulting value is used in PHP's setcookie(). There is no mention of specifics limits in documentation, so in practice the value is limited by ...


2

Most obvious reason could be the fact wpseo_title filter is firing before you have saved your title. Try moving title_storage() call on a earlier stage like. The wp action should be a good candidate.


2

In general I wouldn't recommend modifying the original uploaded image files, just in case we might need to re-generate intermediate sizes. But let's see if it's possible :-) We can in general let WordPress choose the image editor, that depends on modules like GD or Imagick, through: $editor = wp_get_image_editor( $file ); but this can return an WP_Error ...


1

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

There is no clean way to filter whole sidebar and such, but then that's not what you really need. The calendar widget (assuming you mean native one) uses get_calendar() function, which passes result through get_calendar filter. It would be preferable to filter its queries, but from quick look at the code they seem highly messy and not easy to override.


1

You should never change a core file. This message is called by the function wp_get_attachment_link(). For this singular message this function does not apply a filter, but it return the string as value, which can help. You can simple identify where in your theme this function is called and change it return, like: $result = wp_get_attachment_link(); if ...


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 ...



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