• @phamtungpth: WP Pipes uses the constant OB_PATH_PLUGIN for the path to the WordPress site plugins folder and is hardcoded to a specific path ('wp-content' . DS . 'plugins' . DS).
    However, the path can be indeed different, like on roots.io Bedrock WordPress sites, but on any WordPress site because the plugins folder path is configurable.
    This causes WP Pipes not to find any WP Pipes extensions from installed plugins.

    The WP_PLUGIN_DIR constant can be used instead which always has the correct path for any WordPress site configuration.

    So
    define( 'OB_PATH_PLUGIN', ABSPATH . 'wp-content' . DS . 'plugins' . DS );
    has to be replaced with
    define( 'OB_PATH_PLUGIN', WP_PLUGIN_DIR );
    Or WP_PLUGIN_DIR directly used instead of OB_PATH_PLUGIN.

    • This topic was modified 6 years, 8 months ago by strarsis.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter strarsis

    (@strarsis)

    Addendum: WP_PLUGIN_DIR can’t be directly used instead of OB_PATH_PLUGIN anyway because a directory separator is expected at the end (DS constant).

    New fix: Replace
    define( 'OB_PATH_PLUGIN', ABSPATH . 'wp-content' . DS . 'plugins' . DS );
    with
    define( 'OB_PATH_PLUGIN', WP_PLUGIN_DIR . DS );

    Addendum 2: However, appending DS to OB_PATH_PLUGIN results in WP Pipes not finding the extensions. But omitting DS at the end results in a ‘File not found’ error in models/pipe.php when adding the processor (Ajax response in Web Developer Tools Network Tab)…
    In models/pipe.php the $path_plugin is constructed without appending DS to OB_PATH_PLUGIN, so OB_PATH_PLUGIN is expected to have DS appended.
    But the extension discovery code apparently has issues with DS appended to OB_PATH_PLUGIN as the extensions (here processor) is not listed anymore.
    $path_plugin = OB_PATH_PLUGIN . $name . DS . $name . '.php';
    Also note that $path_plugin is also defined in the same way in controllers/pipe.php, so the fix has to be applied there, too.

    • This reply was modified 6 years, 8 months ago by strarsis.
    • This reply was modified 6 years, 8 months ago by strarsis.
    • This reply was modified 6 years, 8 months ago by strarsis.
    • This reply was modified 6 years, 8 months ago by strarsis.
    Thread Starter strarsis

    (@strarsis)

    Addendum: And in helpers/common.php:
    Replace

    		if ( ! is_file( $xml_dir . DS . $file . '.xml' ) ) {
    			$xml_dir = OB_PATH_PLUGIN . $file;
    		}

    with

    		if ( ! is_file( $xml_dir . DS . $file . '.xml' ) ) {
    			$xml_dir = OB_PATH_PLUGIN . DS . $file;
    		}

    This makes the processor options show up.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Hardcoded plugins folder path’ is closed to new replies.