Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving WordPress support? #51

Open
graham73may opened this issue Feb 27, 2024 · 4 comments
Open

Improving WordPress support? #51

graham73may opened this issue Feb 27, 2024 · 4 comments

Comments

@graham73may
Copy link

Thanks for the add on, I've been replacing Livereload with this and it's been great.

I work on Drupal and WordPress websites, the Drupal projects are quite URL agnostic but the WordPress websites are constantly trying to redirect me to a URL without the :3000 port number.

I'm not sure what functionality is available to add ons, would modifying the wp-config-ddev.php file be an option?

My current work around is to add the below code snippet to the auto generated wp-config-ddev.php file.

  • Commenting out the old WP_HOME and WP_SITEURL lines.
  • Adding some code that allows any domain.
 /** WP_HOME URL */
  //  defined('WP_HOME') || define('WP_HOME', 'https://wbg.org.uk.ddev.site');

  /** WP_SITEURL location */
  //  defined('WP_SITEURL') || define('WP_SITEURL', WP_HOME . '/');

  /** Allow any domain/port. (For browsersync) */
  $domain = sprintf('%s://%s', $_SERVER['SERVER_PORT'] == 80 ? 'http' : 'https', $_SERVER['SERVER_NAME']);

  define('WP_SITEURL', $domain);
  define('WP_HOME', $domain);

Maybe it would be better to only allow the project URL(s) in their original form and with :3000 so it's not too loose?

Thanks,

@tyler36
Copy link
Collaborator

tyler36 commented Feb 27, 2024

Hi @graham73may

Thanks for the report. I don't use WP so I'm not sure the best solution. It would be nice if we did have something though.

@graham73may
Copy link
Author

Is it possible for an addon to modify the ddev-generated wp-config-ddev.php file?

Failing that, is it possible for the addon to detect the DDEV project type === "wordpress" and then echo some tips into the console?

@rfay
Copy link
Member

rfay commented Mar 8, 2024

It is in fact possible, see how ddev/ddev-redis does it for Drupal config. And absolutely possible to output help when detecting project type as well.

@graham73may
Copy link
Author

Ah nice! Thanks for the clues @rfay. Will see if I can put a PR together.

https://github.com/ddev/ddev-redis/blob/main/redis/scripts/setup-drupal-settings.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants