WordPress plugin changes install directory when deleted and reinstalled - php

Embarrising enough, I created this particular plugin. Works great, but in testing, this happens:
1. Install plugin via WP Dashboard zip installer.
1a. Works great; fully functional.
2. Deactivate & delete files via WP Dashboard.
3. Reinstall plugin (#1 above).
- Issue: In the theme's plugin folder, a sequential number is appended to the plugin's folder, e.g. "my-plugin" becomes "my-plugin1"
This is a very light weight plugin, only loads a form, script, CSS file, shortcodel. - no SQL tables, no user settings, etc.
Any ideas? I've never repeatedly installed, removed, then reinstalled a plugin, so this is a new thing for me.
Thanks!

Related

WordPress settings BEFORE installation

I would like to edit the WordPress files before installation to my needs.
For each WordPress installation I am changing certain settings, pages, posts and the theme. So I would like to make these changes once and have my changes applied by the installation.
Here you can find the normal WordPress files: https://de.wordpress.org/download/#download-install
I followed this post to stop posts and pages from being created and also found some code in wp-admin/includes/upgrade.php to define pages to start out with.
How to delete the default hello world post BEFORE Wordpress install
From this post I took the info to set the starting theme, which can be found in wp-includes/default-constants.php. But that post had a warning to "NEVER EVER edit the CORE files" – kanlukasz
Set WordPress default settings before installing
So my questions are:
How to activate plugins on installation?
How to edit the settings on installation, like time format, media upload format and avatar format-> false
How to properly set the theme before installation?
Happy for every answer or pointers to other topics.
There's three main parts to a WordPress install, which I'll generally (although arbitrarily) identify as pre-work, installation, and setup.
The commands below assume you have WP-CLI installed and available on your system. They make no assumptions about your server, be it Apache, Nginx or IIS (except for rewrite which only works with Apache). At our company we actually use the Symfony CLI binary for local development server since we get a TLS cert and proxy.
As noted in the comments, you can also go down a different path using composer, and the most common one is probably the Bedrock install. I'm not going to touch on that, they've got plenty of documentation.
Pre-work
In this phase you need to get the database setup, create the directory to hold WordPress and download it, and create a wp-config.php file. You can do all of this from the CLI, too, although your commands might vary for the database depending on your version and flavor.
In this example I'm creating a database named t_low with a username and password of the same.
# Setup database
mysql -uroot -p -e "CREATE DATABASE t_low; GRANT ALL PRIVILEGES ON t_low.* TO t_low#localhost IDENTIFIED by 't_low';"
# Download WordPress
mkdir t-low
cd t-low
wp core download
# Create config
wp config create --dbname=t_low --dbuser=t_low --dbpass=t_low
Installation
This is fairly straight-forward, pretty much the options you'd see if you went through the web GUI. On development sites I don't bother with passwords because they just clog up my password manager, too, but could be provided here if you want to.
# Install WordPress
wp core install --url="https://t-low.wip" --title="Demo Site" --admin_user="person#example.com" --admin_email="person#example.com" --skip-email
Setup
At this point, WordPress is technically installed, so this is where you can change/tweak/delete things like plugins, themes and settings. Obviously don't run all of these blindly, take a moment to think through what they do and if they are applicable for you. Most of these are part of my company's default install.
# Install and optionally activate plugins
wp plugin install health-check --activate
wp plugin install one-time-login --activate
# Remove existing plugins
wp plugin delete hello
wp plugin delete akismet
# Remove extra themes
wp theme delete twentytwentyone
wp theme delete twentytwentytwo
# Turn on debugging
wp config set WP_DEBUG true
wp config set WP_DEBUG_LOG true
wp config set WP_DEBUG_DISPLAY true
# Delete sample data
wp post delete $(wp post list --post_type='post' --format=ids)
wp post delete $(wp post list --post_type='page' --format=ids)
# Set rewrite structure
wp rewrite structure '/%year%/%monthnum%/%postname%/'
# Disable avatars
wp option set show_avatars 0
# Change the time format
wp option set time_format "Y-m-d"
Your next question might be "how do I know what options to change" and that one is trickier. Sometimes you can just run wp option list and find an option that is obvious to change. Other times you might need to run that command and save the output somewhere, make the change in the GUI backend, then re-run the command to see the difference.
With all CLI commands you can append --help to get a better understanding of things. You can also find info online, but I think the CLI is more descriptive.
There's also several third-party WP CLI packages to install that you might find helpful, and some plugins even ship with their own. For instance, on most of my sites I install the one-time-login plugin wp plugin install one-time-login --activate so that I can do wp user one-time-login chris#example.com to get a magic login link and not have to worry about passwords.
Lastly, you can very easily write your own commands. There's a little bit of boilerplate stuff that you need to get down, but otherwise it is pretty straightforward WP/PHP code then.
Also, for plugins that aren't in the main directly you can still install them via a zip file or URL:
wp plugin install file.zip --activate
wp plugin install https://example.com/file.zip --activate
Some of those plugins, such as ACF, allow you to store activation keys in wp-config.php, which is really awesome. This is not universal, however, and totally up to the plugin developer.
wp config set ACF_PRO_LICENSE "XYZ"

WordPress Site missing Dashboard after migration

I had a WordPress installation which I recently moved to a new Linux host. My host is for three website. I already had a WordPress site at the home directory (/public_html/). The later installation is at 'public_html/mukharsamvad.com'. The first WordPress installation is working fine. But the website with domain name 'mukharsamvad.com' is not showing any media (photos etc.). Even after logging into 'wp-admin' it doesn't directs to dashboard. Admin bar appears at the top, but doesn't have any menu or option.
After checking the URLs of images, I have found as 'http://mukharsamvad.com/wp-content/uploads/2019/10/nitish-kumar-11-1.jpg/'. It is treating it as directory. Please recommend me fixes.
Removed old installation and re-install WordPress. After restoring database, problem with image urls solved, but Dashboard still missing.
Here what you can do
check by deactivating all the plugins
change the theme
if not worked , switch for theme editor.
install classic editor plugin and enable it
if this not worked ,
inspect element & check console for errors.
it sounds like you are missing file of Wordpress I would suggest you to compare each directly with installed WordPress if you still don't solve problem then take backup of migrating WordPress installation do fresh installation then override the backup files

WordPress Manual Install Theme/Display Issue

My Problem
I manually installed WordPress on a Debian 9 VM in Virtual Box on a Windows 10 machine. When I pull up the website, this is what I get:
A WordPress site with just HTML, no formatting
The point of this install was to learn how to make a custom WordPress theme. I have built child themes before, but never a theme from scratch, so it may be I don't have everything set up yet. But there is a second issue is WordPress does not give me an option to select my second theme either.
What I did
To set up the site, I followed this tutorial on setting up WP on a Debian system. I sort of touched up on this, but I am new to WP development. I thought this was a quick and dirty route to set up a WP install. I don't have the knowledge of WordPress to know if there is an error in this setup guide.
Again, I checked the themes folder. I could not find the custom theme I started to build as an option. I can't currently download themes straight from WP because I don't have an FTP server/client currently installed on my machine. If it were just the inability to choose a WordPress theme from the WordPress theme repository, I'd suspect it's the FTP setup. But, I also can't choose my custom theme. So is there something wrong with the install?
Summary
I can't get any formatting to work on my WP development site. I suspect it's some problem with themes, but I don't know enough about the internals WordPress to know how to diagnose the problem.
Thank you for your time
It's tough to say without seeing your setup exactly, but this is often caused by URL problems.
Are you able to access wp-admin? If so, try logging in and visiting the settings > permalinks page, then just hitting the save button.
Try reloading your site. It might be fixed.. If not, a little more to try. First, I'd open your browser's Console / Inspect mode, and see if there are any console errors (showing CSS files not loading, etc). If so, post them here.
Additionally, I found a helpful article that details some other things to try when this problem pops up:
http://wphelp24.com/how-to-fix-wordpress/how-to-fix-wordpress-css-not-loading/

My WordPress site got updated and also few plugins. site is not loading any more. What i can do it to win it back

I have WordPress site and it is updated new version. I don't know how. Few plugins also got updated. Now sites page is not loading. Server is working fine but pages are loading.
I don't have back up. How should I get back the things.
This is a good time to learn your lesson about backups. Always have a backup.
It's most likely that one plugin is breaking your site. You can copy the /wp-content folder of your site to your computer using FTP and then (after copying it locally!), one by one, delete the plugin folders in wp-content/plugins themselves on your site over FTP. After deleting each plugin folder, check if your site is back up.
If you find the offending plugin, try reinstalling it through the WordPress admin panel. Because you deleted the plugin folder and not the database entries, the settings should still be there, but your local copy is in case of further emergency anyway.
You can try renaming your plugin folders via FTP connection. Do that one-by-one and reload the site each time. They will be deactivated after you do this, and you will find the plugin which is causing the problem.

Wordpress Theme is not Responsive to Updates

I have a WordPress theme that's installed and has been running fine for a while. I recently needed to update the theme itself, and I did so use the built-in theme editor. Upon reloading the site, the theme changes are not presented in the markup.
Removing the index.php file from the theme or changing its name results in a blank page as expected, but removing all contents of the theme's index.php does not have a similar effect. In fact, the WordPress installation continues as if I had not made index.php blank.
I have no caching plugins installed, Varnish is not present, memcached is not in use at all, and neither is APC.
I attempted upgrading all the plugins and WordPress itself. The raw-html plugin I have installed failed to update with a fatal error about an include on line 16, but that include was not present. The update worked fine when I renamed the plugin filename though (from raw_html.php to raw_html1.php).
I have found that the cache is the biggest issue when dealing with WordPress; Even when you don't have the cache enabled for the site. I have found that if I make the edit and look at it later, the changes have been updated.
This is not ideal for development.
Sometimes a plugin will have some type of a caching issue (even if the plugin doesn't deal with the cache) that causes the problem.

Categories