Tag Info

New answers tagged

0

When a new post is created (regardless of status) post_name which is the slug is saved to the WP_Post object. You can fire off a wp_ajax_$youraction() in the backend to get the post object and return the slug. https://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_(action) Cheerz, Wil.


0

With respect to @cybmeta's contribution, I think that the Types plugin may be throwing us a curveball. He is correct in that you cannot (at least in this context) add a filter at the point of save_post without creating an infinite loop. As I was trying to access the value of a meta field, his suggestion for updated_post_meta may be appropriate, but didn't ...


1

You hook the tr_change_show_title to a filter inside the function itself, that can make a infinite loop. All the stuff removing/adding actions and filters inside the functions should be deleted; instead check if the post data should be updated or not. In your case you should check if the title has the value you desire or not, if not run wp_update_post with ...


0

I was able to resolve this problem. It would appear that the 'save_post' action occurs prior to the init that is registering the custom post type. Therefore, the post type's rewrite slug is not updated prior to the request to flush_rewrite_rules, essentially resulting in no update. This also explains why it works if the post is saved a second time, since the ...



Top 50 recent answers are included