public function detectChangedPermalink()
    {
        // if permalink not changed, return, do nothing more
        if ($this->permalinkBefore === $this->permalinkAfter && !$this->trashed) {
            return false;
        }

        if ($this->trashed) {
            App::$externalDetector->lookForBrokenLinks('internal', str_replace('__trashed', '', $this->permalinkBefore));
            return true;
        }

        // Replace occurances of the old permalink with the new permalink
        global $wpdb;

        $wpdb->query(
            $wpdb->prepare(
                "UPDATE $wpdb->posts
                    SET post_content = REPLACE(post_content, %s, %s)
                    WHERE post_content LIKE %s",
                $this->permalinkBefore,
                $this->permalinkAfter,
                '%' . $wpdb->esc_like($this->permalinkBefore) . '%'
            )
        );

        $this->permalinksUpdated += $wpdb->rows_affected;

        if ($this->permalinksUpdated > 0) {
            add_notice(sprintf('%d links to this post was updated to use the new permalink.', $this->permalinksUpdated));
        }

        return true;
    }
public function detectChangedPermalink()
    {
        // if permalink not changed, return, do nothing more
        if ($this->permalinkBefore === $this->permalinkAfter && !$this->trashed) {
            return false;
        }

        if ($this->trashed) {
            App::$externalDetector->lookForBrokenLinks('internal', str_replace('__trashed', '', $this->permalinkBefore));
            return true;
        }

        // Replace occurances of the old permalink with the new permalink
        global $wpdb;

        $wpdb->query(
            $wpdb->prepare(
                "UPDATE $wpdb->posts
                    SET post_content = REPLACE(post_content, %s, %s)
                    WHERE post_content LIKE %s",
                $this->permalinkBefore,
                $this->permalinkAfter,
                '%' . $wpdb->esc_like($this->permalinkBefore) . '%'
            )
        );

        $this->permalinksUpdated += $wpdb->rows_affected;

        if ($this->permalinksUpdated > 0) {
            add_notice(sprintf('%d links to this post was updated to use the new permalink.', $this->permalinksUpdated));
        }

        return true;
    }
public function detectChangedPermalink ( ) { // if permalink not changed, return, do nothing more if ( $ this -> permalinkBefore === $ this -> permalinkAfter && ! $ this -> trashed ) { return false ; } if ( $ this -> trashed ) { App :: $ externalDetector -> lookForBrokenLinks ( 'internal' , str_replace ( '__trashed' , '' , $ this -> permalinkBefore ) ) ; return true ; } // Replace occurances of the old permalink with the new permalink global $ wpdb ; $ wpdb -> query ( $ wpdb -> prepare ( "UPDATE $wpdb->posts
                    SET post_content = REPLACE(post_content, %s, %s)
                    WHERE post_content LIKE %s" , $ this -> permalinkBefore , $ this -> permalinkAfter , '%' . $ wpdb -> esc_like ( $ this -> permalinkBefore ) . '%' ) ) ; $ this -> permalinksUpdated += $ wpdb -> rows_affected ; if ( $ this -> permalinksUpdated > 0 ) { add_notice ( sprintf ( '%d links to this post was updated to use the new permalink.' , $ this -> permalinksUpdated ) ) ; } return true ; }
Detect and repair
@return void
Detect and repair