Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: When using get_post_permalink on wp_insert_post the old permalink is returned
- Author: Addcode
- Version: 1.0
- */
- /*
- * To replicate the issue the following database settings need to be true:
- * - Make 'Example post type' translatable
- * - Translate custom posts slugs (via WPML String Translation).
- */
- add_action('init', function(){
- register_post_type('example', array(
- 'label' => 'Example post type',
- 'public' => true,
- ));
- });
- // Trigger cache
- add_action( 'pre_post_update', function() {
- get_permalink();
- });
- // Try logging new permalink
- add_action( 'post_updated', function($post_id) {
- error_log(get_permalink( $post_id ));
- }, 10, 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement