Support » Plugin: LH Archived Post Status » property “post_status” on null in “lh-archived-post-status.php”

  • Resolved adaddario

    (@adaddario)


    Hi! Im asking for support.
    I am developing a custom page in wordpress with PHP and relatives queries with wp_db to show dynamic data stored in the database, in this case a list of specific posts with the post_status parameter == to “archive”. I’m developing in a locally installed WordPress with a localDB on Xampp. The version of WordPress is the latest and all the plugins are updated to the last version relesed.

    the php code I wrote have the following tasks:

    the first code has the task of showing a list of dynamically generated years based on the creation date of the archived posts.

    the second code will have the task of displaying a list of archived posts based on the previous year chosen by the user in the previous list of archived posts divided by year (post creation year).

    That said, the problem is the following:
    The page that has the task of displaying a list of posts archived based on the chosen year (according to PHP code) does not work if the year chosen in the query is before or after 2021 (therefore 2022, 2020 and so on), showing the following PHP error appears on the screen:

    “Warning: Attempt to read property” post_status “on null in C: \ xampp \ htdocs \ wordpress \ wp-content \ plugins \ lh-archived-post-status \ lh-archived-post-status.php on line 512”

    And under this WordPress says that the page was not found.

    the error is written twice. going to view the source code of the plugin I see no problems …

    screen:https://gyazo.com/79621874e8bf18c89cbb0a876f81c11f

    I checked the mysql database and comparing the posts archived for year 2021 and those with different year like 2022 or 2020, where the problem is present, there is no data difference except rightly the creation date that I manually changed from wordpress / mysql. I also checked the plugin settings later but I don’t notice any problems. The other strange thing is that the archived post is not viewable through a query but if I click on the “view” link within wordpress in the post section, it is correctly displayed on the page.

    the PHP codes are as follows:

    code 1: https://gyazo.com/0fae2bf66a01189e820e4901c1eaeea3

    code 2: https://gyazo.com/b333594c479476a269d24a859973942a

    I hope I made the idea as clear as possible, thank you very much in advance!

    EDIT: I forgot to mention that the plugin is broken… if I remember good your plugin should be able to manage the archiving date, but somehow i cant add or change that parameter from wordpress options, both in posts edit options and plugin options.
    To do that i installed another plugin called “Post Expirator”, that let me activate the expiration date via post options and then specify the date and more options are available in the plugins settings.

    • This topic was modified 2 months, 4 weeks ago by adaddario.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author shawfactor

    (@shawfactor)

    What version of wordpress are you on?

    I ask as this plugin may not work proerly beyond 4.9.

    In instead of updating this plugin though I plan to relase a whole new one, shortly. Migrating the upgrade path is somethinG ican´t be bothered doing so it will be new plugin but it should be mostly commpatible with the old one.

    Peter

    Plugin Author shawfactor

    (@shawfactor)

    I am closing this thread for good order but I will still monitor it and reopen if necessary.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.