• Notice: post_permalink is deprecated since version 4.4! Use get_permalink() instead. in /home/apcstage/public_html/wp-includes/functions.php on line 3573

    seems to line 111 in \w3-total-cache\lib\W3\SharedPageUrls.php

    here is working version of the function

    /**
         * Returns all urls related to a post
         * @param $post_id
         * @return array
         */
        function get_post_urls($post_id) {
            if (!isset($this->post_urls[$post_id])) {
                $full_urls = array();
                $post_link = get_permalink($post_id);
                $post_uri = str_replace($this->domain_url, '', $post_link);
    
                $full_urls[] = $post_link;
                $uris[] = $post_uri;
                $post = get_post($post_id);
                $matches =array();
                if ($post && ($post_pages_number = preg_match_all('/\<\!\-\-nextpage\-\-\>/', $post->post_content,$matches))>0) {
                    global $wp_rewrite;
                    $post_pages_number++;
                    for ($pagenum = 2; $pagenum <= $post_pages_number; $pagenum++) {
                        if ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
                            $post_pagenum_link = trailingslashit($post_link) . user_trailingslashit("$wp_rewrite->pagination_base/" . $pagenum, 'single_paged');
                        else
                            $post_pagenum_link = trailingslashit($post_link) . user_trailingslashit($pagenum, 'single_paged');
                        $full_urls[] = $post_pagenum_link;
                    }
                }
                $this->post_urls[$post_id] = $full_urls;
            }
            return $this->post_urls[$post_id];
        }

    https://www.ads-software.com/plugins/w3-total-cache/

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hi..

    I checked on https://codex.www.ads-software.com/Version_4.4 this code not listed as deprecated, but on developer.www.ads-software.com listed as deprecated. Did they missed to add it on version 4.4 changelog?

    Should I edit the plugin or there’s going to be a plugin update with this issue?

    This issue is affected us too when we reply to a comment from the main comments page in the dashboard. WordPress gives a message in red:

    Notice: post_permalink is deprecated since version 4.4! Use get_permalink() instead. in /var/www/pphblog_sandbox/wp-includes/functions.php on line 3573

    There is only 1 usage of this method in W3 Total Cache:


    plugins/w3-total-cache/lib/W3/SharedPageUrls.php
    111: $post_link = post_permalink($post_id);

    +1 for now I used @paul Bearne patch and replaced the call with get_permalink.
    But I hope they will fix it upstream.

    Thank you!

    I hope W3TC updates soon. In the meantime I disabled the plugin. I was receiving multiple different errors. Namely, in these files:

    wp-includes/functions.php on line 3573
    wp-admin/post.php on line 197
    wp-includes/pluggable.php on line 1228

    Not sure about the patch above since it was probably made to address the permalinks error but maybe not the other 2 I experienced. Can’t afford to break the site at the moment!

    rabin.io: +1 for now I used @paul Bearne patch and replaced the call with get_permalink.

    Same here, thanks, seems to work so far.

    I’ve also disabled the plugin for now, had people report they could not update posts with this error in the multisite network.

    @olavxxx: If this PHP notice is shown to users, probably “debug” mode of WordPress is enabled on you site. Would recommend to disable it.

    https://codex.www.ads-software.com/WP_DEBUG

    Hi, I know. I turned it on for the purpose of PHP7 compatability.
    It’s just turned on for our internal IP-adress though, I think warnings should be fixed before they become errors.

    I hope W3TC updates soon. In the meantime I disabled the plugin. I was receiving multiple different errors. Namely, in these files:

    wp-includes/functions.php on line 3573
    wp-admin/post.php on line 197
    wp-includes/pluggable.php on line 1228

    Not sure about the patch above since it was probably made to address the permalinks error but maybe not the other 2 I experienced. Can’t afford to break the site at the moment!

    I have same issue :/

    I wouldn’t hold out much hope of an update soon. The last meaningful update was August 2014.

    At any rate, a deprecated error is not a show stopper so you should be fine continuing with the notice. You can hide your debug errors via wp-config

    Hello,

    I’d love to see this (use of post_permalink()) fixed in the next update as well, please.

    Thank you!

    Sweet, thank you Paul.

    Can confirm this is still a problem on Version 0.9.4.1. Except function intro comment started at line 103 in the same file, in \w3-total-cache\lib\W3\SharedPageUrls.php.

    Thread Starter Paul Bearne

    (@pbearne)

    run the plugin with debug (xDebug) turned on and you will see the error

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Notice: post_permalink is deprecated’ is closed to new replies.