Is there a way for "Editor only" Actors

Btw, I tested this:

I wrote a C++ actor and wrapped the class inside “if WITH_EDITOR” and created a blueprint from it. I placed an instance of the blueprint in the level and had it print a string at BeginPlay. But when packaging the linker throws an error. It tries to link the methods and classes that are within the wrapped WITH_EDITOR and complains that there are no such classes and methods declared anywhere. This happens in MyProject.generated.h (if MyProject is my project name)