the_modified_date returns published date

I think that you are using Parsidate plugin to convert dates to Hijri date. The plugin since the current version(2.2.2) returns the published date for both the_date and the_modified_date functions. This is a bug that i reported it to them. For now, you can use the wp-jalali plugin instead, that solved the problem for me.

How to do conditional publishing?

That’s because the hook “transition_post_status” is called: After the post has been published or updated in the database After the status has been updated in the database. Based on your problem statement, I believe the hook you want is “pre_post_update”, as stated in relevant WordPress source code: /** * Fires immediately before an existing post … Read more

Posts created in a Custom Post Type are lost if published without a title

The function that’s in charge of saving posts on the database (wp_insert_post) requires at the minimum a title and content: http://codex.wordpress.org/Function_Reference/wp_insert_post Edit: I created a quick and dirty jquery solution. Input this in your functions file or in a plugin: <?php add_action(‘admin_head’, ‘post_title_check’); function post_title_check() { ?><script type=”text/javascript”> jQuery(document).ready(function($) { $(‘input[name=”save”]’).click(function() { if($(‘input[name=”post_title”]’).val() ===”) { … Read more

Unpublish all posts in a category

You need to get the published posts in the category then run wp_update_post() inserting the new status. Here is a quick function. I am attaching it to admin init. I would also turn it off after your statuses are updated. function wpse_55018_get_update() { for( $i = 0; $i < 10; $i++ ) { // Runs … Read more

get_terms on save_post hook

You’re on the right track. When you do something like this in a form.. <input name=”tax_input[formats][]” /> You create levels in the $_POST array. So you’d get the formats array like this… <?php $formats = $_POST[‘tax_input’][‘formats’]; Full example… <?php add_action(‘save_post’, ‘wpse74017_save’); function wpse74017_save($post_id) { // check nonces and capabilities here. // use a ternary statement … Read more

Limit number of posts a user can make per minute?

I would begin with establishing the most friendly approach to this. I think it would be a warning after post Publish/Update button is clicked. It is possible to prevent the Edit Post screen loading if the user re-visits it within 2 minutes after the previous post is published. I don’t think that is practical though … Read more

Action on post publish

If your aim is to trigger code when a post is published, as in, the post_status of the post is set to publish, then you can hook into save_post like this: function cc_publish_wpse_263985( $postid ) { // check if post status is ‘publish’ if ( get_post_status( $postid ) == ‘publish’) ) { // do something … Read more

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