Hot answers tagged

10

I usually just avoid the issue entirely every time I create a new wordpress site: define('WP_HOME', '/'); define('WP_SITEURL', '/'); will cause wordpress to use root-relative urls for everything. Makes site migrations to other domains far easier. Ofc, if you access your site using a folder (eg. "http://<domain>/blog") you could change them to: ...


8

If anyone out there has a similar situation as me, I found a solution by adding: /* That's all, stop editing! Happy blogging. */ /** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); /* THIS IS CUSTOM CODE CREATED AT ZEROFRACTAL TO MAKE SITE ACCESS DYNAMIC */ $currenthost = "http://".$_SERVER[...


7

Open wp-config.php Now the first thing you need to do is to open the wp-config.php file from your WordPress root folder (you may access this file from your WordPress installer folder). From the installation folder, the file is located at wordpress/wp-config.php 2. Insert FS_METHOD Paste the following code to your wp-config.php file, preferably just below ...


6

date() is a PHP function depending on your server settings. You can go around that by using the WordPress function: current_time( 'Y-m-d H:i:s' ); This function takes the settings in wp-admin into account.


6

Congratulation Jon, welcome to the WordPress world! To fix the issue, just add the following line of code in your installed WordPress's wp-config.php file. It's a PHP constant declaration which tells the WordPress to avoid the FTP. That's it. define( 'FS_METHOD', 'direct' ); For more info: https://codex.wordpress.org/Editing_wp-config.php#...


4

I use Dropbox as well, but not directly linked as the Dropbox folder path could differ from install to install. My Dropbox just is the root of my bare git repository. Simplified... When I start coding, I just add a new folder to my Dropbox and --bare init it. // Inside your Dropbox/webdev/themes folder for e.g. git --bare init Then inside your new Theme ...


4

Is there no way to pull the content to a localhost site just to get the content onto the site so that I can work on the development of the site while the client adds the content to the live DB? If the remote server supports it, you can connect to the remote database. Just set your connection constants correctly: // ** MySQL settings - You can get this ...


4

Per the Codex entry for the_post_thumbnail(), passing an array has not worked since WordPress 3.0: PLEASE NOTE: The crop does not work in WP 3.0+. All that is needed for WP 3.0+ is the call for the thumbnail to post. Then proceed to media in the dashboard and set your thumbnail to crop to the size you wish to use. The correct implementation is to create ...


3

The objection that XAMPP is bloated--because it has a mail server, FTP server, etc.--might be answered by asking what you need. If you need most or all of those items, it's the full XAMPP for you. For just developing web pages, including PHP and MySQL, use XAMPP Lite. At different times I've found both to be very useful. I especially like that I can run ...


3

It is painful to clone the wordpress site sometimes when the site has a lot of plugins and custom code. I did it manually before. But I am using "Duplicator" plugin to handle this now. Please check: https://wordpress.org/plugins/duplicator/


3

I think s_ha_dum is in the right track, but I think he got it backwards. You want to: develop/design locally connect to the REMOTE database and work with his content? You need a remote (staging) installation of WordPress, where the client can create/enter his content. You need your local WordPress site (localhost) to point to the remote database, to grab ...


3

Your issue likely lies somewhere within wp-config.php. You should not need to run any install if your tables already exist, the wp-admin/install.php is only used when no tables are detected with the settings in wp-config.php. Going through parameter by parameter, I'll give you some idea of what everything is. DB_NAME is the name of the database that ...


3

You are missing the Phar extension or it's not enabled. Which version of PHP are you actually running? Check it with php --version. The Phar extension is bundled with PHP as of PHP version 5.3.0, and enabled by default. See https://www.php.net/manual/en/phar.installation.php. Your best bet is to upgrade PHP to at least PHP 7.1. Alternatively follow ...


3

I finally managed to scrape together enough information from disparate sources to figure out how to fix this, because - as I'm increasingly finding with anything related to Wordpress development - the documentation is so woefully inadequate. The fact that it took so much research and hacking together on my part just to get an official command-line utility ...


2

Another solution is to simply chown the entire wordpress install to the user that apache is running as: chown -R _www: myWPSite Then you can do your automatic updates, and if necessary, chown it back to the previous owner.


2

I'd like to add an advantage of WAMP that is not listed. With WAMP you can install extensions* that allow you to easily switch between different versions of php. Since WordPress's minimum requirement is php 5.2.4 and guarantees it will run on a server using it, to be truly compatible with WordPress a plugin needs to run under that version of php. There are ...


2

WP plugins are meant to be loaded in context of WordPress core load. They won't work as vanilla PHP, unless you purposely abstract some parts completely away from WordPress. The typical practice is to have actual working WP installation locally and develop in its context.


2

It looks like you have not imported the backup of database (sql file) to new database you have created in your localhost. Also after importing the database to local server you will need to replace the live site URL with new localhost URL at all instances in local database.


2

WordPress do not work like Facebook or Twitter. Each WordPress installation is a separate application, it has its own database where users are stored, each installation is independent of one another. Your localhost installation of WordPres has no connection to the one on the server they are two entirely different entities. But you can copy all contents from ...


2

Let's assume you've installed WordPress as described here, directly in a folders named 816 under your xampp/htdocs/, and this, without any alterations (modifying settings or any configurations to neither your xampp nor WordPress installation); having defined the nameservers of your domain name (here, example.com) to point to your IP, let's say: 192.182.230.1,...


2

There are at least two interesting questions on SO: Cygwin and PHPUnit: Could not open input file: /cygdrive/c/xampp/php/phpunit Composer & Cygwin The easiest seems to be putting an alias into your Cygwin's ~/.bashrc or ~/.bash_profile: alias wp="/cygdrive/b/Users/User/XAMPP/php/php /cygdrive/b/Users/User/XAMPP/php/wp"


1

There is actually nothing unique about setting multisite on XAMPP, all you need to do is properly configure the webserver as a proper webserver, and skip the lazy practice of using localhost as your site domain. Select some random domain you are not likely to use in your web use, edit your hosts file to point that domain to 127.0.0.1, and set the vhost in ...


1

DocumentRoot for each VirtualHost should point to the directory where you installed WP multisite. There is no actual directory for subsites, they're all virtual. Using your example: <VirtualHost *:80> DocumentRoot "C:/home/wp-intall-directory" ServerName mysite-1.dev # not required Alias /mysite-1.dev "/home/mysite-1" <Directory "/...


1

Make a backup of files/db, download again Wordpress (4.4.2), overwrite all files and check again. Check the php version, folder structure, reset files permission and/or update Xampp if needed. If not working, try the backup in Mamp (OSX) or EasyPHP (Win) to exclude a Xampp problem. If you want take a look at https://serverpress.com


1

Could be a few things causing it. Have you altered any core files or wp-config in anyway? Are the themes definitely valid, they have a style.css file with the required information filled in? I'd recommend setting up a completely fresh WordPress installation. Copy each theme in one at a time and make sure they show up. If they do, it's most likely ...


1

As long as you know the username you can have WP automatically log you in. You might need to ask your friend what that is. Check to see if you're logged in and if not, get user by login, set the current user along with the auth cookie then redirect to the ~~user's admin~~ url or edit user url to change the password. Place this in the functions.php of the ...


1

get_stylesheet_directory_uri() Note that this returns a properly-formed URI; in other words, it will be a web-address (starting with http:// or https:// for SSL). As such, it is most appropriately used for links, referencing additional stylesheets, or probably most commonly, images. get_stylesheet_directory() Retrieve stylesheet directory Path for the ...


1

And this is why I post to stackexchange. I worked on this for a month, then as soon as I posted the question I found a resolution (Thanks to Milo as well that confirmed my suspicions). The solution was that the script the freelancer had done was trying to call the full URL, and on a localhost it tried to grab the file url. the solution was to replace all ...


1

It's not clear what "cannot access WordPress from [other Win7 machine on network]" actually means. I have this same setup and it works fine. Be sure to check these things: Do you have Apache and MySQL services running? Check XAMPP Control Panel Can your other Win7 machine access the folder WP is in? ie. 192.168.3.3/dir-wp-is-in/ Can your server machine ...


1

get_template_directory() Retrieves the absolute path to the directory of the current theme, without the trailing slash. You should use get_template_directory_uri(); for showing correct image path on site. echo get_template_directory();?>/library/images/name_of_the_svg_image will work in your case. Details here


Only top voted, non community-wiki answers of a minimum length are eligible