Notification when visitor is on specific WordPress Article

There’s no is_article. I assume you guessed there would be analogously to is_page, but I don’t think article is a built-in WordPress post type. I think you want is_page instead, which looks like it covers all post types. You should also move the page check into the action handler, to be sure that WordPress has … Read more

Display post changelog in post

There are many ways to do it, without third party plugins: Shortcode Cons: shortcode has to be created, and added to all posts. Child theme template Cons: theme dependent, and right template has to be modified. Child theme functions.php Cons: theme dependent. Plugin in mu-plugins Cons: none. Pros: not theme dependent, easiest to implement. Implementation … Read more

Problems with Page Not Found

So yes, the key point here is that you should put the WordPress-specific 404 template file in the theme directory (e.g. wp-content/themes/your-theme/404.php) and not in the root WordPress directory. And despite that you already got the solution, I thought you would still want an answer to the following? I would like to figure out what … Read more

Remove password protected posts from default RSS feed

Here’s the filter to exclude password protected posts from the default RSS feed: function rss_filter_protected( $query ) { if ( $query->is_feed ) { $query->set( ‘has_password’, false ); } return $query; } add_filter( ‘pre_get_posts’,’rss_filter_protected’ );

Can’t set Post ID properly

‘import_id’ (int) The post ID to be used when inserting a new post. If specified, must not match any existing post ID. Default 0. Accordingly to the documentation, the ID needs to be an integer. So no letters are allowed unfortunately.

How to display all posts divided/ordered by post date? [closed]

You should be able to achieve this with something like the below… <?php $wpb_all_query = new WP_Query( [ ‘post_type’=>’post’, ‘post_status’=>’publish’, ‘posts_per_page’=> -1, ‘orderby’ => ‘date’, ‘order’ => ‘ASC’ ] ); $dividers = []; ?> <?php if ( $wpb_all_query->have_posts() ) : ?> <div id=”list_allposts”> <?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?> <?php $post_date = get_the_date( … Read more

Find the Post ID of a post from another website

WordPress’s REST API should provide the information you need. If you’re after a post with the slug the-slug-you-want, then you can request the data about any post(s) with that slug using the URL https://example.com/wp-json/v2/posts/?slug=the-slug-you-want. This returns the post(s) with that slug, and in the post’s/posts’ JSON objects the ID is available.

Disable link for single posts

you can either disable click events using CSS. .linkclass { pointer-events: none;} Or better Modify the template and remove the part which creates anchor links for titles. note: with the above, it is still possible to access the page by directly putting the full URL in the browser. if you want to completely remove the … Read more