0

I have some custom php code outside of the wp-content of the wordpress, ie www.xyz.com/test

Calling the code below it works just fine, BUT if I enable the qtranslate-x that will add the language literal ie www.xyz.com/fr/test the result is "404 file not found."

require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');

What can I do the resolve the problem ?

Maverick
  • 1,105
  • 12
  • 41
  • You need to either exclude URLs that begin with `/test/` or route your custom URLs in WordPress itself. – Walf Nov 06 '16 at 11:44
  • Excluding directly from htaccess does not seem to work. Routing urls to Wordpress is unknown method to me! – Maverick Nov 06 '16 at 17:16

1 Answers1

3

Do you really need plugins when loading wordpress core? This is the core to load a minimum configuration (without plugins and themes):

   define('SHORTINIT', true);
   require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');

If you need theme support you can this trick:

  define('WP_PLUGIN_DIR', '');
  require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');

  /* start theme */
  get_header();
  the_content();
  get_footer();

All code in you functions.php should be loaded fine

nektobit
  • 843
  • 7
  • 11