Advertisement

How to Reset Article Hits

Need help with the Administration of your Joomla! 5.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
User avatar
Bikerdave
Joomla! Explorer
Joomla! Explorer
Posts: 268
Joined: Tue Jul 17, 2007 12:43 pm
Location: South West England Near Exeter

How to Reset Article Hits

Post by Bikerdave » Sun Sep 08, 2024 8:09 pm

I have seen a lot of questions in various places on how to reset the Article Hits easily so here is a set of steps that will allow you to do one or all of them. It can also be used if you want to set the Created By Alias for all the Articles.

I am not an SQL expert but managed to work this out from an old v1.5 post and a little trial and error.

I suggest that you read all of the steps before starting.

Method
1. Log Into your cPanel to access phpMyAdmin

2. If you have more than one database, select the one you want to modify from the list.

3. * * * BACKUP YOUR DATABASE * * *

4. When you see the list of Tables select xxxxx_content where xxxxx is the table prefix. You will now see a list of all of the Articles in your database.

5. Click Edit for the first item and scroll down to the item you want to reset i.e. hits (If you want to reset just one or two articles then its probably easier to do it manually.)

6. Click and highlight the number in the hits box, enter your new number i.e. 0 (zero)

7. To update this one Article only Hit enter or scroll down and hit Go

To update ALL of the Articles’ hits, follow steps 1 – 6 above then;

8. Instead of Hitting Enter in step 7, scroll down to the bottom of the screen and you will see Preview SQL, click on that and a box will pop up with the SQL Query Code you need for updating the hits on the one Article you selected.

UPDATE `xxxxx_content` SET `hits` = '0' WHERE `xxxxx_content`.`id` = 1
This code shows you that you will set the hits to 0 in ONLY Article Item ID 1.

9. Select this code and copy it to clipboard.

10. Click on the SQL TAB at the top of the screen and click OK to leave Unsaved Changes

In the Query Box there may already be some code click and highlight then paste the code you just copied from the clipboard. You can now edit this code, so if you want to do all of the Articles in one go the remove the WHERE code to this

UPDATE `xxxxx_content` SET `hits` = '0'

11. You will get the message “Do you really want to Execute UPDATE . . .”
Cancel if you do not, otherwise click OK

Using this method allows you to update other fields such as the Alias for example, I created all of the Articles but don’t want my name to appear, so rather than go through each Article or content table and update them manually I can use this string.

UPDATE `xxxxx_content` SET `created_by_alias` = 'Name'

Hope that this helps!

PS. If you are using Joomshaper Pagebuilder the database table is xxxxx_sppagebuilder
http://www.moorweb.co.uk

Rules Stifle Creativity

Advertisement
gws
Joomla! Champion
Joomla! Champion
Posts: 6316
Joined: Tue Aug 23, 2005 1:56 pm
Location: South coast, UK
Contact:

Re: How to Reset Article Hits

Post by gws » Sun Sep 08, 2024 8:55 pm

Thanks Bikerdave.

Advertisement

Post Reply

Return to “Administration Joomla! 5.x”