Remove hyperlink to edit post in edit.php

You can remove the a tag with javascript, short and easy. Use the follow plugin; include a small script in the footer of the edit.php, only this page in backend of WP and remove all a-tag inside the table; see the selector on the source below. <?php /** * Plugin Name: Remove a * Version: … Read more

Is there an action that is called when a post is restored from the trash?

There are multiple actions. Listed in order of appearance with their parameters: untrash_post – (int) $post_id // before restoring transition_post_status – (string) $new_status, ‘trash’, (object) $post trash_to_{$new_status} – (object) $post // useful to address a special trash to status action untrash_post_comments – (int) $post_id // before associated comments are untrashed untrashed_post_comments – (int) $post_id // … Read more

How to hide a post from ‘Recent Posts’ widget?

You can exclude posts from the recent posts widget via the widget_posts_args filter: add_filter( ‘widget_posts_args’, ‘exclude_posts_wpse_103570’); function exclude_posts_wpse_103570( $args ){ // post ID’s to exclude: $args[‘post__not_in’] = array( 123, 234, 345 ); return $args; }

get post id in while loops outputting page id

Dont use query_posts or WP_Query if you need it in the main loop. Dont ever use query_posts anyway. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php $current_id = get_the_ID(); ?> <?php echo $current_id ?> <h1><?php the_field(‘titleFart’, $current_id); ?></h1> <?php endwhile; // end of the loop. ?> <?php endif; ?> … Read more

Undelete post (untrash)?

There is not wp_undelete_post but you have other choices: wp_untrash_post(): when post is trashed, the previous status is stored in _wp_trash_meta_status meta field. wp_untrash_post() restore trashed posts to previous status whatever it was; for example, private, inherit, publish. I’ve not tested it but it should work with a custom post status as well. wp_publish_post(): if … Read more

Unique post-id for WordPress Multisite Network

Yes. Use $post->guid instead of $post->ID. NB: guid must be in lowercaps for it to work. Detailed explanation here: https://wordpress.stackexchange.com/a/209832/71131 Some additional detail on the purpose of keeping $post->ID as a backup in your third-party service: https://wordpress.stackexchange.com/a/209833/71131

get_post_type_archive_link(‘post’) returns current category archive

get_post_type_archive_link() doesn’t return a link for the post type post, because technically it has no archive registered on registration of the post type. You can check this, if you inspect the output of get_post_type_object( ‘post’ ). So actually get_post_type_archive_link( ‘post’ ) will return false – see source. You can get the link for the page … Read more