How to disable edit post option? [closed]

This will restrict all users, except admins to edit a post after one day. You can, however, change the allowed user roles or time by simply tweaking the code. function wpse405644_restrict_editing() { $screen = get_current_screen(); if ( $screen->base == ‘post’ && $screen->post_type == ‘courses’ ) { $post = get_post($_GET[‘post’]); $user = wp_get_current_user(); if ( !in_array( … Read more

Showing Unpublished Posts to Logged-out Users?

Answered my own question on this one. As it turns out, it was pretty simple in WordPress 2.9.2. Basically, I applied a filter to ‘the_posts’ which would run another query if the object was empty. Because we’re looking up posts that haven’t been published, we need to use our own custom SQL as well. Trying … Read more

Notify Author of the post if admin deletes his post and perform some function

Firstly, it’s better to user WP functions than write your own SQL. Even though it might be a bit more expensive: $post = get_post($post_ID); $authorid = $post->post_author; Secondly, it’s not get_usermeta(), but get_user_meta() and the complete call should include true as the third parameter: $currentPointNumber = get_user_meta($authorid, ‘points’, true); And then it’s update_user_meta(), again, and … Read more

Stop Authors from submitting spam post

If your really worried I would probably create custom write panels or custom meta boxes tied into custom post types. That way you can make the custom post types based on user role and control what shows up very easily. For instance you can make a custom post type called “tweens” with the user role … Read more

Redirecting to a post based on a GET parameter and a custom field

remove the else after the foreach: add_action(‘parse_request’, ‘fid_parse_request’); function fid_parse_request($wp) { // only process requests with “fid” if (array_key_exists(‘fid’, $wp->query_vars) && $wp->query_vars[‘fid’] != ”) { $args = array(‘post_type’ => ‘faculty_profile’, ‘meta_key’ => ‘wid’, ‘meta_value’ => $wp->query_vars[‘fid’] , ‘numberposts’ => 1); $redirect_to_post = get_posts($args); if (!empty($redirect_to_post ) ) { foreach ($redirect_to_post as $p) { $link = … Read more

How to get override the WP Admin Syndication feed limit for a custom feed?

This is no normal filter. It’s a filter_ref_array. // Use this to alter your limit: add_filter( ‘post_limits’, create_function( ‘$a’, “return ‘LIMIT $start, 10’;” ) ); EDIT After I saw that this got marked as solution, I want to show you a more “best practice”-approach: function alter_feed_post_limits( $limits ) { return ” LIMIT 0,50″; } add_action( … Read more

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