
WordPress code snippets for hooks, custom post types, the REST API, WP_Query, admin screens and more. Copy, paste and adapt.

Product cat is category name for WooCommerce products category. Thanks, Hammad Wali for sharing this useful code!

Print a WordPress excerpt without HTML tags, shortcodes or a read-more link, cut to a word limit, for cards and templates.

Print just the WordPress category, tag, taxonomy, post type or author archive name in your archive template, without the Category: prefix.

after the file path add array, version and then print An entire block stored in function.php should look like this. You can always add it as @media print but with this you will have much more flexibility and load it where you need it. More about Print CSS: https://www.sitepoint.com/css-printer-friendly-pages/ https://www.smashingmagazine.com/2018/05/print-stylesheets-in-2018/

Change the WordPress excerpt length from 55 words to any number, with an optional length per post type, in one small filter.
![Change the WordPress Excerpt […] to a Read More Link](https://code.dplugins.com/wp-content/uploads/2020/01/post-143-thumbnail-1.jpg)
Replace the […] at the end of WordPress excerpts with an accessible Read more link to the right post, escaped and translatable.

List WordPress related posts from the same category under a single post, without the current post and without a plugin.

In code block when you are using script add to PHP tab: You need to put path from /wp-content/ and not just plugins folder PHP JavaScript Note: Got this trick from a good friend Alexander Buzmakov. Visit his tutorials oxywp.com.

Open preferences by pressing Command + “,” And paste the following snippet Taken from: https://gist.github.com/supawaza/8009192

List the categories of the current WordPress post as escaped links on a single post template, with a class on the primary category.

Show the custom taxonomy terms of the current WordPress post on its single template, as links with a CSS class per term for badges.

Highlight the search terms in WordPress search results: wraps the words in titles and excerpts in , in classic and block themes.

List all WordPress categories or custom taxonomy terms as links with a current-cat active class, on archives and on single posts.
3rd party plugins actions admin archive block-themes block editor Blocks block theme build capabilities core CSS Custom Post custom post types Developer development filters Front End full site editing gutenberg hook Image img load styles maintenance media mu-plugin Must Have npm Oxygen performance php plugins scripts organizer security SEO settings api single product theme.json Tips updates WooCommerce wordpress wp-cli WP Admin