How to limit the pages displayed for choosing parent page on page attribute’s menu?

This meta box is printed with page_attributes_meta_box and the select field for choosing parent is generated with this code: if ( is_post_type_hierarchical( $post->post_type ) ) : $dropdown_args = array( ‘post_type’ => $post->post_type, ‘exclude_tree’ => $post->ID, ‘selected’ => $post->post_parent, ‘name’ => ‘parent_id’, ‘show_option_none’ => __(‘(no parent)’), ‘sort_column’ => ‘menu_order, post_title’, ‘echo’ => 0, ); $dropdown_args = … Read more

How do I know if author field was changed on post save?

Best Hook for that would be wp_insert_post_data function wpse44358_filter_handler( $data , $postarr ){ //do your stuff //if ($data[‘post_author’] == … return data; // make sure you return something } add_filter( ‘wp_insert_post_data’ , ‘wpse44358_filter_handler’ , ’99’, 2 );

add_filter on “the_excerpt” only works when post does not have excerpt

I posted an article about this a while ago: function wp_trim_all_excerpt($text) { // Creates an excerpt if needed; and shortens the manual excerpt as well global $post; $raw_excerpt = $text; if ( ” == $text ) { $text = get_the_content(”); $text = strip_shortcodes( $text ); $text = apply_filters(‘the_content’, $text); $text = str_replace(‘]]>’, ‘]]>’, $text); } … Read more

Detecting Embed URLs Within post_content

OK, got it. I just dug around in wp core a bit and found the function they use to grab autodetcts. WP uses the php preg_replace_callback function within the WP autoembed function. Here is the code, as seen in wp-includes/class-wp-embed.php: /** * Passes any unlinked URLs that are on their own line to {@link WP_Embed::shortcode()} … Read more

Anyway to edit the titlebar of WordPress Widgets in the Admin area?

I believe you are looking for $params = apply_filters( ‘dynamic_sidebar_params’, $params ); (look here: https://github.com/WordPress/WordPress/blob/master/wp-includes/widgets.php#L706). Now this filter will evaluate both in front end and back end. so to answer your question, you could wrap your filter in a if( is_admin() ){ // Do icons } check. Better yet, you could define this at registration … Read more

Can I add custom meta for each image uploaded via media-upload.php?

Yes, you can add fields, an example function rt_image_attachment_fields_to_save($post, $attachment) { // $attachment part of the form $_POST ($_POST[attachments][postID]) // $post[‘post_type’] == ‘attachment’ if( isset($attachment[‘rt-image-link’]) ){ // update_post_meta(postID, meta_key, meta_value); update_post_meta($post[‘ID’], ‘_rt-image-link’, $attachment[‘rt-image-link’]); } return $post; } // now attach our function to the hook. add_filter(“attachment_fields_to_save”, “rt_image_attachment_fields_to_save”, null , 2); see more on this post

Modify the post/entry wrapper markup in genesis childtheme [closed]

Today I had a similar issue and this worked for me: /** * Add and extra class to the entry-content div * */ function vdl_entry_content_extraclass( $attributes ) { $attributes[‘class’] = $attributes[‘class’]. ‘ my-custom-class’; return $attributes; } add_filter( ‘genesis_attr_entry-content’, ‘vdl_entry_content_extraclass’ ); In my case, I am adding this code to my single-portfolio.php template because I only … Read more

Hook into admin post list page

From your screenshot and explanation I guess I understand what you’re trying to accomplish. Concept Point is, that the question is more a X-Y Problem. What I’d recommend is changing the idea and use as much of what is available per default: The Quick Edit box. Quick Edit The default hook to extend quick edit … Read more

What to use instead of the content_save_pre filter?

What Adam Brown’s site says is that the hook no longer appears in 3.8. I greped a 3.9 and found: bash-4.2# grep -Rni ‘content_save_pre’ * wp-includes/kses.php:1327: * The wp_filter_post_kses() function is added to the ‘content_save_pre’, wp-includes/kses.php:1344: add_filter(‘content_save_pre’, ‘wp_filter_post_kses’); wp-includes/kses.php:1370: remove_filter(‘content_save_pre’, ‘wp_filter_post_kses’); wp-includes/default-filters.php:89:foreach ( array( ‘content_save_pre’, ‘excerpt_save_pre’, ‘comment_save_pre’, ‘pre_comment_content’ ) as $filter ) { Interestingly the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)