Search results posts_orderby and ID
Search results posts_orderby and ID
Search results posts_orderby and ID
I would hook that on publish_post, so you aren’t messing with drafts, etc. And you need to account for multiple categories, and count the number of posts in each, and delete anything over 10. Perhaps something like this will get you in the right direction. May need some tweaking, mostly untested. function on_post_publish( $ID, $post … Read more
Short answer “no”, using globals is never a best practice, indicates that you might be trying to do something in the wrong place, and should be left as a last resort. In your snippet for example you have no idea who set the $post, was it set in the loop or outside it, was it … Read more
What you see in the edit post columns is controlled by manage_posts_columns filter. By playlist_id i assume you are looking for the post_id (since you mentioned playlists are simply custom post types). You can do so by using this code in your theme’s functions.php file: if ( !function_exists(‘add_playlist_id_to_column’) && function_exists(‘add_theme_support’) ) { // Add our … Read more
What hook do you use to update a post?
I suggest you use the pre_get_posts action hook provided by WordPress. Then, in your functions.php add the following code below: function custom_pre_get_posts($query) { // validate if(!is_admin() && $query->is_main_query()) { if(is_archive()) { $query->set(‘orderby’, ‘title’); // order posts by title $query->set(‘order’, ‘ASC’); // and in ascending order } } } add_action(‘pre_get_posts’, ‘custom_pre_get_posts’); You can learn more about … Read more
filter RSS feed in URL
Is there a way to notify specific users when new posts are published to specific pages?
How to attach an image to a post through Java
The content_edit_pre filter might be what you are looking for. This filters the content of a post before it’s retrieved and output in the editor. So you might be able to do this: function save_team( $content, $post_id ) { $team = get_post_meta ($post_id , ‘hometeam’, true); if( get_post_type( $post_id ) == “game” && get_post_status( $post_id … Read more