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

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.

YouTube embeds Cross-Origin Request Blocked (CORB) error

I have found out that i have enabled tracking protection in that particular Firefox profile. A relevant warning, which i oversaw by just displaying the errors, was also displayed. The resource at “https://googleads.g.doubleclick.net/pagead/id” was blocked because content blocking is enabled. Apparently https://googleads.g.doubleclick.net/pagead/id. does honor the tracking protection setting. Today i learned to use a clean … Read more

WordPress broken dashboard with ninja-shell text

Since you found a suspicious user, there’s a good chance your site has been hacked. The easiest thing to do is have the professionals take a look. At minimum, install a new security plugin and scan your site, delete suspicious files, take the time to weed out unused plugins and update everything, change your login … Read more

counting slugs not working?

Now I’m however getting: Fatal error: Uncaught Error: Undefined constant “cat” That’s because the cat and post_tag were not wrapped in quotes (e.g. ‘cat’), and they also did not start with the dollar sign ($) as in $cat, which indicates a variable, hence PHP tried to find the constants named cat or post_tag, and when … Read more

Creating an array with gettexed terms

To adapt the second part of your code to work with the first part, where you are using wp_dropdown_categories to generate the dropdown list, you can use the get_terms function to retrieve all terms of the tipologia taxonomy and then iterate over them to create your $names_trans array. In the wp_dropdown_categories call, you pass the … Read more

Count post with tags within one category?

Yes it is possible to count the posts with certain tags within a particular category. You can achieve this by using a combination of wp functions like WP_Query to retrieve posts and get_terms to retrieve the tags within the specified category. <?php $category_slug = ‘donotallowpost’; $term_slugs = [ ‘cat’, ‘bird’, ‘chinchilla’, ‘dog’, ‘ferret’, ‘hamster’, ‘horse’, … Read more

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