Forum Replies Created

Viewing 15 replies - 196 through 210 (of 349 total)
  • @amyls

    Happy to help. The code snippet should work on any posts in draft status that are published. It uses built-in hook that WordPress provides “draft_to_publish”. So when a draft is published, it takes on published date instead of original draft date.

    I tested it on a draft I had created in March, and when I hit “publish” it used April 1 as the published date.

    Does your setup use anything custom like a custom post status maybe?
    Do you usually hit “publish” button inside post edit screen? Or use some other method to publish them?

    ^V

    Ok good, this is default behavior not an issue. So now we simply need to update the date to the correct one when you publish posts. We do that with this code, which should be put into your theme’s functions.php file:

    function post_published_date( $post )   
    {  
        // Apply this to posts only 
        if ($post->post_type == 'post')   
        {  
            // Update the date 
            $pub_post = array(  
                'ID'            => $post->ID,  
                'post_date'     => date("Y-m-d H:i:s"),  
                'post_date_gmt'     => date("Y-m-d H:i:s")  
            );  
          
            // Update database  
            wp_update_post( $pub_post );  
        }  
    }  
    add_action( 'draft_to_publish', 'post_published_date' );

    When you hit Publish, this will automatically update your date. If this solves your issue, don’t forget to mark this topic as resolved. Thanks 🙂

    ^V

    @szoszk

    The access log looks fine, but the admin-ajax.php should not be your source URL.

    You mentioned you’ve tried a few solutions from the web. Have you tried disabling all your plugins and/or enabling default theme to see if the issue goes away?

    Before you do anything, make sure to have a full backup of files and database.

    If not, start with plugins. Disable all of them, test uploads. If it works, then enable plugins one by one testing uploads after each activation until you find plugin responsible for this.

    If issue persists with all plugins disabled, then activate default theme like twentyseventeen and test uploading again.

    If it still does not work, there may be an issue with your WP core. And my next step would be to re-install all core files manually through FTP. You don’t touch database, you simply delete core files/folders and upload a fresh set. Make sure you do not delete wp-config.php, htaccess, and wp-content folder.

    Let me know how it goes.

    ^V

    Are you able to edit wp-config.php? If so, when you enabled debugging your debug.log will be created inside /wp-content/ folder.

    If you don’t have access to edit wp-config.php, you might need to contact your hosting provider and see if they can help you regain access.

    ^V

    One thing that can cause this issue is when your disk space or number of inodes is full. I saw this happen last week to one of our websites. If you just installed WP and there’s nothing else on your hosting account, this is not an issue most likely. But if you have other sites or limited space, something to check.

    If disk space is not an issue, the next step I would try is enabling debugging and checking debug.log for errors. You can find details here:
    https://codex.wordpress.org/Debugging_in_WordPress

    When you enable debugging, make sure to go through the login process so it generates errors in the debug.log. Looking at the errors (if any) will help pinpoint the culprit causing your login issues.

    ^V

    @szoszk you said in your initial post “Although in that case the src of the image is some php file.” Can you share what that URL is and php file? You can remove your domain or replace it with example.com. I’m more curious as to what the URI following your domain name is in this case.

    You can enable WordPress debugging and check out debug.log file to see if there are any errors. That’s usually one of the best places to look for errors. More info:
    https://codex.wordpress.org/Debugging_in_WordPress

    Your hosting error log should be in the “public_html” folder if cPanel hosting, called error_log. But that doesn’t always get populated with errors.

    ^V

    First thing I would try is to clear your browser cache. Sometimes cookies can cause login issues. You can also try logging in using Chrome Incognito or Firefox Private mode, which eliminates cookies.

    See if that works.

    ^V

    If you click on the empty image inside media library, what URL do you see on the right side?
    Media library image modal

    ^V

    • This reply was modified 9 years, 1 month ago by ProjectArmy.

    Does each draft use that specific date (Oct 27, 2016) no matter when you create it? Or, it uses the correct date when the draft was created as the publishing date? So if draft was created Dec 15, 2016 it will use that date instead of Mar 26, 2017.

    Just want to clarify.

    ^V

    It’s hard to say what’s causing an issue. But, we can try to regain access to your admin.

    You’ll need access to your FTP/SFTP account. It is also a good idea to create a backup of your website before making any changes just in case. Your hosting panel should have an option to create a backup of all the files and databases.

    The first thing you need to do is to disable all your plugins. A plugin conflict or issue can be causing this. When you login to your FTP account, you’ll need to navigate to “wp-content” folder. Inside this folder you will see “plugins” folder. Simply rename “plugins” folder to something else, like “plugins2”. Now, try and see if you can navigate to your WordPress admin via wp-login.php or wp-admin. If you’re able to login, then one of the plugins is causing this issue.

    If you still get the same error. The next step is to disable your theme. Inside “wp-content” folder, you will see “themes” folder. Click on it. Inside it, you will see either your theme folder or you might see several different folders for other inactive themes. You need to figure out which folder is your active theme and then rename it, like we did with plugins folder. This will deactivate your theme. After this, try to login again. This should work now.

    Start with those 2 steps to regain access to your admin. Let us know what worked.

    ^V

    Hi, uploading images via FTP does not work. This is default behavior. WordPress associates every upload through media library to an entry in the database. That’s how it knows where everything is and how to associate files with pages/posts.

    What happens when you upload an image using media library? Do you see an error? Or does the image show up broken?

    ^V

    What error do you see when you try to login at /wp-login.php?

    ^V

    This is normal behavior for WordPress. Certain scripts are removed by text editor for security. In order to include scripts inside a page or post editor, you need to use a plugin that allows you to save your script to database and display it on a page/post using a shortcode.

    You can check out this plugin that will do the job:
    https://en-ca.wordpress.org/plugins/insert-html-snippet/

    ^V

    Start with your htaccess file. If you have any custom rules in htaccess file, try removing everything but default WordPress rules.

    If that doesn’t work, try resetting your permalinks. Simply go to Settings > Permalinks and click “Save” button. This will reset them.

    If that doesn’t work, I would recommend enabling debugging mode and checking debug.log to see what might be causing 500 error with your AMP pages. Usually errors in debug.log will help you identify the issue or another plugin (or theme) that’s conflicting with AMP pages and causing 500 error. More on WordPress debugging is here in the Codex.

    ^V

    It’s not really up to the plugin when Google will find/index your AMP pages. You have everything setup, including “amphtml” links on your pages where AMP version is available.

    Now you just have to wait on Google to index them. It’s up to Google to index them, and however long that takes. If you have done so, you can validate AMP pages and then request indexing of them using Google’s validator. It’s different from AMP Project’s validator:
    https://search.google.com/search-console/amp

    But again, it’s up to Google to index them.

    ^V

Viewing 15 replies - 196 through 210 (of 349 total)