how to check if the post id has a new comment?

There is a WordPress hook comment_post to retrieve recently added comment and to pass comment id to get_comment you will get the post id. add_action( ‘comment_post’, ‘show_message_function’, 10, 2 ); function show_message_function( $comment_ID, $comment_approved ) { $comment_array = get_comment($comment_ID ); $comment_post_id = $comment_array->comment_post_ID; }

how use php query in AJAX jquery

You need to edit the PHP associated with the AJAX action call_post. If you want to return different data, you should pass a parameter in the request that you handle later; data:”action=call_post&template=custom&”+checked, Ideally, you could just return the data rendered from php with a flag data:”action=call_post&template=custom&format=html&”+checked, From a PHP perspective, you would find your parameters … Read more

How to only fetch certain Tag ID’s

get_tags function accepts include argument. You could pass by it ids of tags you want to get. $tags = get_tags(‘order=ASC&orderby=name’); change to $tags = get_tags(‘order=ASC&orderby=name&include=12,45,67’); 12, 45 and 67 are ids of tags get_tags on codex

pages disable after wordpress update

I had just changed the version number in version.php back to 4.5.3 (was playing with wp-cli but don’t ask why, LOL) and saw this exact error — Googled it and saw this post. My bet is your version.php didn’t get updated. Look in it and check the version number to see if it is what … Read more

Custom Theme, Editor won’t wrap text (i.e. change width)

This is normal behaviour. First, the class second_column of your site is set to max-width:100%. This means it has no fixed width. You won’t notice this on a pc screen, but if you reduce you browsers width to mobile size, you will see the text column becoming narrower. This is good, because it means that … Read more

How to make 2 similar functions more efficient

You’ve passed those $upgrader_object and $options parameters to prefix_plugin_upgrade function. But you’re not actually using those parameters inside the function. So you can merge those functions like below- /** * Update plugin settings on activate * Update plugin settings on upgrade */ function prefix_plugin_activate() { $new_option = array( ‘new_setting’ => ‘on’ ); $existing_settings = get_option( … Read more

Dynamically Create Posts Via XML File

Yes. From your description, it appears that all of the requirements to automate this process are in place. The data is provided via XML which can be parsed with PHP to the necessary title, body, meta components. [search] WordPress supports programmatic post insert/delete/edit functions so that part is fairly simple. [WP Codex] Now you just … Read more