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

.Net Core web | PeachPie wordpress not working fully #136

Open
anilkumarvs opened this issue Mar 8, 2023 · 10 comments
Open

.Net Core web | PeachPie wordpress not working fully #136

anilkumarvs opened this issue Mar 8, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@anilkumarvs
Copy link

Hi Benjamin,

As per your suggestion in your reply email, I am posting my issue with PeachPie here.
We have integrated peachpie in one of our .Net Core web app. We have configured routing so that the wordpress content is within a sub folder like, https://localhost:7388/wp/

Most of the functionality is working. But when we install a new plugin or theme it is not fully working. Showing lot of errors. I have prepared a copy of the .Net solution with the peachpie installation. Could you please have a look and provide feedback to resolve the issues.

See below the link to download the source

https://1drv.ms/u/s!AjBWHxiL50SrhNYcnFgLP0pyfDxv-g?e=cFybND

Thanking you in advance.
Anil Kumar

@anilkumarvs anilkumarvs added the bug Something isn't working label Mar 8, 2023
@anilkumarvs
Copy link
Author

anilkumarvs commented Apr 3, 2023

Hi,

Adding more to above issue details, I am including a video link to explain the issues/errors I am facing.

https://1drv.ms/v/s!AjBWHxiL50SrhNZTb6r2zN0SEBD45A?e=HVONYv

Hope this will help you to understand the issues more clearly and suggest the fixes.

Please see below the Key sections in video with time code.

Video Timecodes
0.17: Current WP version 6.0.1
0.29: Site Health - Critical Issue
1.00: Installed plugins issues and errors
2.25: Pages view, only basic WP functionality available
2.15: Settings page - settings
3.55: User page settings
4.10: Tools and Code Problems (detailed list of errors)
6.23: Tools and Code Problems (critical issues)
6.50: Site health passed tests

Thanking you in advance,
Anil Kumar

@bfistein
Copy link
Contributor

Hi @anilkumarvs,
Can you please provide more info on how your project is structured? How does your app configuration look like? Make sure you follow this tutorial when setting things up please.
Can you also list the NuGet dependencies and their versions please? Quite often these types of issues are due to version mismatches.
Thanks,
Ben

@anilkumarvs
Copy link
Author

anilkumarvs commented Apr 17, 2023 via email

@jakubmisek
Copy link
Collaborator

@anilkumarvs Thank you, Anil, for all the details and the video! and sorry for the delay.

The Site Health can be ignored for now; as most of the features are overridden by the ASP.NET Core pipeline anyways. It can be improved through various settings though.

The code errors (red ones) are basically "full-stoppers" - nothing will work with those errors. For larger websites with lots of larger plugins and themes, it will be necessary to avoid installing plugins from the WordPress dashboard and follow the .NET approach - compile plugins in the build time. It'll get significantly faster as well.

Please take a look at our example: https://github.com/iolevel/peachpie-wordpress/tree/master/MyContent
This is described at https://docs.peachpie.io/scenarios/wordpress/build-php-plugin/

  • Create a separate project next to your C# ASP.NET Core app, called for example Vlenza.YourHomeOurHome.WpContent. Vlenza.YourHomeOurHome.WpContent/plugins folder should contain ALL your plugins, the same way as it would be in WordPress (beaverbuilder, wordpress-seo, etc...)

    • ./Vlenza.YourHomeOurHome.WpContent/
    • ./Vlenza.YourHomeOurHome.WpContent/plugins/
    • ./Vlenza.YourHomeOurHome.WpContent/Vlenza.YourHomeOurHome.WpContent.msbuildproj // as in example
  • Create <ProjectReference /> from your C# ASP.NET Core Web to Vlenza.YourHomeOurHome.WpContent project.

    <ProjectReference Include="../Vlenza.YourHomeOurHome.WpContent/Vlenza.YourHomeOurHome.WpContent.msbuildproj">
      <PrivateAssets>None</PrivateAssets>
    </ProjectReference>
  • Remove the plugins downloaded from within WordPress dashboard somewhere at wordpress/wp-content/plugins/**.

  • Disable WPDOTNET_HOTPLUG_ENABLE option. (https://docs.peachpie.io/scenarios/wordpress/configuration/#extra-settings). Add the following to your appsettings.json:

    "WordPress": {
        "Constants": {
          "WPDOTNET_HOTPLUG_ENABLE": 0,
      }
    }
  • Build your C# project; You're now getting all those errors in build time.

Sadly, those errors (red ones) must be fixed. Most of the erroring code can be removed. I'd recommend adding plugins subsequently.


Please let me know the progress. After the steps above, it is expected to have:

  • no Code Diagnostics with errors in the WordPress dashboard
  • 4th project called Vlenza.YourHomeOurHome.WpContent with your WordPress plugins
  • WordPress plugins compiled in build time within Visual Studio, resulting in compilation errors

@anilkumarvs
Copy link
Author

anilkumarvs commented Apr 17, 2023 via email

@anilkumarvs
Copy link
Author

anilkumarvs commented Apr 18, 2023 via email

@bfistein
Copy link
Contributor

Hi Anil,

Are you seeing PHP errors in the WP dashboard? You should not have to download any plugins through the dashboard though, have you followed the aforementioned tutorial and added them to your wp-content/plugins folder one by one? As Jakub mentioned, we recommend adding them one by one to make sure we isolate any issues. Then you can build the solution and activate them in the dashboard.

I can't see any screenshot attached btw.

Yoast SEO is known to have quite a few problems in their source code, so it's quite conceivable that there are PHP bugs that are causing our compiler to throw an exception. Elementor is generally much better.

In terms of themes, the process is very similar to plugins, just add the theme to the wp-content/themes folder and build.

Best,
Ben

@anilkumarvs
Copy link
Author

anilkumarvs commented Apr 19, 2023 via email

@jakubmisek
Copy link
Collaborator

Hi Anil, that's exactly how it should be. Nicely done.

@anilkumarvs
Copy link
Author

anilkumarvs commented Apr 19, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants