WP Gutenberg – How to parse simple images?

When you return $post->post_content you’re returning the raw content from the database. Things like shortcodes, dynamic blocks and responsive image markup will not exist in the content. To prepare content for output you need to run it through the the_content filter: ‘content’ => apply_filters( ‘the_content’, $post->post_content ), That being said, there is already an endpoint … Read more

Remove rel=”nofollow ugc” from links in comments

This removes the tag before it displays the comment on the page. I tested it myself. function remove_ugc_from_links($text) { // replace ‘rel=”ugc”‘ with an empty string $new_text = str_replace(‘rel=”ugc”‘, ”, $text); return $new_text; } // Hook our function to the ‘comment_text’ filter add_filter( ‘comment_text’, ‘remove_ugc_from_links’);

Execute wp_after_insert_post after the permalink is customized

To execute update_post_meta after the permalink is customized, you can use the save_post hook instead of wp_after_insert_post. Here’s how you can modify your code: add_action(‘save_post’, ‘add_permalink_to_new_post’, 10, 2); function add_permalink_to_new_post($post_id, $post) { // Check if this is a new post if ($post->post_date_gmt == $post->post_modified_gmt) { // Only run this on a newly created post update_post_meta($post_id, … Read more

Change Pages to Post in Woocommerce without Plugin

To change the WooCommerce order pages back to posts without using a plugin, you can modify the post type of WooCommerce orders in WordPress. This can be achieved by adding custom code to your theme’s functions.php file or creating a custom plugin. Here are the steps to do this: Access Your WordPress Files: You can … Read more

Issue with WordPress Plugin Activation Hook and Table Creation

Not sure if this helps but try doing this in the main plugin file: require plugin_dir_path(__FILE__).’inc/plugin-setting.php’; require plugin_dir_path(__FILE__).’inc/db.php’; // Register activation hook in the main plugin file register_activation_hook(__FILE__, ‘wp_comment_reactions’); Move your function wp_comment_reactions to the db.php file and call it from the main plugin file.

Blurry Images on my Website

Text on images always look blurry when you view it at any other size than 100%. You can try saving them as an svg and using that, then you have to install a plugin that let’s you upload svg’s into your site. Or can make it show text on the image but the images you … Read more

Schedule WordPress plugin activation and / or deactivation on a custom date and time, how to do?

It’s not something that WordPress supports out of the box, but I think you can whip up some custom code to achieve this. I think you can use WordPress cron job that will check the current date and time for this to activate/deactivate the plugin accordingly. Here’s an example for deactivating: add_action(‘wp’, ‘plugin_deactivation_schedule’); function plugin_deactivation_schedule() … Read more

Is it possible to use the same slug structure for a taxonomy and for some pages?

Figured out a solution! This intercepts the query at parse_request, checks if a page with a matching slug exists, and if so, changes the request to a page request. /** * Fix rewrite conflicts between “project_category” and “page” * * @param WP $query * @return WP */ function prefix_parse_request_fix_rewrite_conflicts_project_category(WP $query): WP { if (isset($query->query_vars[“project_category”])) { … Read more